How to design a multi-step game menu system?


Posted by: Andrew on 07/01/2016 | Add Revision

I am getting started with game programming. I am designing a game that starts by taking you through a series of menu screens. I am interested in how this type of thing is done in a professional game.

Currently I handle the controller inputs from the main file and have individual classes for each menu screen. When the user makes a selection, I need to transition to the next menu screen. It seems like I either need some sort of "menu screen manager" for keeping track of the previous selection and transitioning between menu screens, and/or I need to pass the controller input handling down to the menu objects, since I want to use up/down on one menu and left/right on the other menu.

How would a professional game programmer architect/design this?

require "components/first_menu"
require "components/second_menu"

first_menu =
second_menu =
menu = first_menu

on(controller: "up")   { menu.prev_option }
on(controller: "left") { menu.prev_option }

on(controller: "down")  { menu.next_option }
on(controller: "right") { menu.next_option }

on(controller: "buttonA") do
  if menu.is_a? FirstMenu
    selected_option = menu.select_option
    menu = second_menu
    selected_option = menu.select_option

Visit Website