-
Notifications
You must be signed in to change notification settings - Fork 2
Pause Menu Display
This documentation describes the structure and functionality of the PauseMenuDisplay and PauseMenuActions classes. These two classes work together to manage the game's pause menu interface and handle the associated button actions such as resuming, restarting, accessing settings, and quitting the game. The pause menu is triggered when the player presses the "ESC" key, which pauses the game and brings up the menu.
- PauseMenuDisplay: Displays the pause menu, allowing the player to interact with the game by using the buttons provided.
- PauseMenuActions: Handles the actions triggered by the buttons on the pause menu (e.g., resume, restart, quit).
The PauseMenuDisplay class consists of several key components for rendering the pause menu:
- isVisible: Tracks whether the pause menu is currently visible.
-
game: A reference to the
MainGameScreen
to control pausing and resuming of the game. - table: A Table object used for organising UI components.
- logger: Logs interactions with the pause menu.
- Textures: Background and koala images used in the pause menu, loaded from assets.
-
createKoalaImage()
&createKoalaImage2()
: These methods create koala images that appear on the pause menu. -
createPauseMenuBackground()
: This method creates the background image for the pause menu. -
createButtonsTable()
: This method creates a table with buttons that trigger various actions like resuming, restarting, accessing settings, and quitting the game. -
toggleVisibility()
: This method is to stack all the images into the background of the pause manu display.
-
displayScreen()
: This method listens for a specific key input (the "ESC" key) to toggle the visibility of the pause menu. When "ESC" is pressed, the pause menu appears, pausing the game. Pressing "ESC" again hides the menu and resumes the game. toggleVisibility(): Manages the visibility of the pause menu and pauses/resumes the game accordingly.
The PauseMenuActions class is responsible for listening to events triggered by the buttons on the pause menu. These events trigger actions like restarting the game, accessing settings, or quitting.
-
game: A reference to the
GdxGame
instance, allowing for screen changes and game control. - logger: Logs button clicks and events for debugging.
The PauseMenuActions
class listens for specific events, each tied to a button on the pause menu:
-
onRestart()
: Triggered when the "Restart" button is clicked. It restarts the game by setting the game screen to MAIN_GAME. -
onExit()
: Triggered when the "Exit to Main Menu" button is clicked. It returns the player to the MAIN_MENU screen. -
onQuit()
: Triggered when the "Quit" button is clicked. It exits the game entirely.
Each button in the pause menu triggers a specific action:
- Resume: Closes the pause menu and resumes gameplay.
- Restart: Restarts the game (onRestart()).
- Main Menu: Exits to the main menu (onExit()).
- Quit: Quits the game (onQuit()).
- Save/Load: Save and Load
- PauseMenuDisplay: Renders the pause menu and sets up buttons for interacting with the game.
- PauseMenuActions: Listens for button events and handles screen transitions and game actions. The two classes work together to provide both the visual interface and the event-driven logic for user interactions in the pause menu.
The PauseMenuDisplay and PauseMenuActions classes work together to manage the visual and functional aspects of the pause menu. While PauseMenuDisplay handles rendering and layout, PauseMenuActions is responsible for reacting to user interactions and triggering corresponding actions in the game. These two components ensure that the pause menu is interactive, responsive, and integrated seamlessly into the gameplay. The menu can be triggered by pressing the "ESC" key, pausing the game and bringing up the menu for the player to interact with.
Inventory System
Scoring System
Food Recipes
Level System
Player Actions
Ordering System
Stations
Items
Map Design
Customers
Pause Menu
Upgrades
End of Day Display
Day Night Cycle
Moral System
Debug Terminal
Game Interactions Tutorial
Backstory Cutscenes
Entities and Components
Input Handling
Game Screens and Areas
Fire Extinguisher Handler Component
MainGameActions Create Docket Triggers
Main Game Order Button Display
BackstoryCutsceneDisplay Test Plan
Test Plan for MainGameOrderTicketDisplay
Test Plan for MainGameOrderBtnDisplay
Test Plan for DocketLineDisplay
Test plan for RandomComboService
Test plan for SpeedBoostUpgrade
Test plan for DancePartyUpgrade