In most games, you’ll probably find yourself needing to implement a menu of some sort. In its simplest form, a menu could be a button which the player clicks with the mouse or taps. But if you’re using keyboard or gamepad controls, implementing a menu requires a little more work.
This tutorial looks at three ideas for a keyboard-controlled menu system – one in a simple grid style, one laid out in a sort of ring shape and one that functions like a scrolling list. They all have similar functionality, including a boolean to track whether the menu is open, which then determines whether or not to make the menu’s layer visible.
The menu system is designed to work with both keyboard and gamepad inputs and uses instance and global variables to track which options the player has highlighted and selected.
So, let’s look at how to set up each style of menu.