Summary of "GameMaker Studio 2: Complete Platformer Tutorial (Part 10: Menu screen)"
GameMaker Studio 2: Complete platformer tutorial (Part 10: menu screen) - Summary
This tutorial covers creating a basic but functional menu screen in GameMaker Studio 2, focusing on setting up the menu room, drawing the menu options, and handling user input to navigate and select options.
Storyline / Context
- This is part 10 of a platformer tutorial series.
- The focus is on implementing a simple menu system before the game starts.
- The menu includes options like "New Game," "Continue," and "Quit."
Gameplay Highlights
- The menu is designed to appear as a separate room with a scrolling background for visual interest.
- The menu options are displayed in the bottom right corner.
- The menu smoothly slides in from the right side of the screen.
- User can navigate the menu using keyboard arrow keys and select options with the Enter key.
- Selecting an option triggers corresponding actions:
- New Game: starts the game.
- Continue: currently acts like New Game (no save/load implemented yet).
- Quit: closes the game.
- A subtle screen shake effect is added when selecting an option for polish.
Key Steps & Implementation Details
1. Setting up the menu room
- Create a new room dedicated to the menu.
- Use multiple background layers with different horizontal scroll speeds to create a parallax effect.
- Place persistent objects like transition and camera in this room (with adjustments to avoid unwanted interactions).
- Position the menu object on an instances layer.
2. menu object Creation & Variables
- Create a
menuobject. - In the Create event, initialize variables:
GUI_widthandGUI_heightfor screen size.GUI_marginfor padding from screen edges.menu_x,menu_yfor menu position.menu_x_targetfor smooth movement target.menu_speedfor easing speed.menu_cursorto track currently selected option.menu_committedto track the selected option after confirmation.menu_controlboolean to enable/disable input.menu_itemsarray containing menu option strings ("New Game", "Continue", "Quit").menu_items_countdynamically calculated from array length.- Font setup for menu text.
3. Drawing the Menu (Draw GUI Event)
- Set font and text alignment (right and bottom aligned).
- Use a for-loop to iterate through menu items from bottom to top.
- Highlight the selected menu item with a right arrow and white color; others are gray.
- Draw text with a simple black outline by drawing the text four times offset by 2 pixels in each direction, then draw the main text on top.
4. Menu Controls (Step Event)
- Ease the menu sliding in from off-screen to its target position.
- Handle keyboard input:
- Up arrow: move selection up (wraps around).
- Down arrow: move selection down (wraps around).
- Enter: commit selection, slide menu off-screen, disable input, trigger screen shake.
- After menu slides off-screen and a selection is committed, perform actions using a switch statement:
- Case 2 ("New Game") and default: transition to the game room.
- Case 0 ("Quit"): close the game.
- Case 1 ("Continue"): currently treated same as "New Game."
Strategies and Tips
- Use arrays to store menu options for easy scalability.
- Use dynamic GUI size variables to make the menu resolution-independent.
- Use easing formulas for smooth UI animations.
- Draw text outlines by layering multiple offset draws for pixel fonts.
- Always set font and alignment before drawing text to avoid inconsistent rendering.
- Use a boolean to disable input during menu animations or transitions.
- Use switch statements for clean handling of menu actions.
- Rename layers if camera objects interfere with parallax scrolling in the menu.
Potential Extensions Mentioned
- Adding mouse control support.
- Expanding menu options.
- Adding save/load functionality for "Continue."
Credits / Sources
- Tutorial by the GameMaker developer featured in the video.
- Patreon supporters thanked: Dan in a Mule, Knicks Lavish, Stephen Hagen, John Grimshaw, Nathaniel Walsh, Bowels of the Dog, Louis R Pereira, Charles Montgomery, Harold Guidry, Jason Macmillan, Owen Morgan.
This tutorial provides a foundational menu system that can be expanded with additional features and polish, ideal for beginners working with GameMaker Studio 2.
Category
Gaming