-
Notifications
You must be signed in to change notification settings - Fork 2
Upgrades
The Upgrade package consists of several classes that define various upgrades available to the player in the game. Each upgrade is represented as a class that implements the upgrade Interface, ensuring a consistent structure for activating and deactivating upgrades. The purpose of these upgrades is to temporarily alter how the gameplay works such as if a player chooses Upgrades for SpeedBoots
then it will increase the player speed for a few seconds. But this will cost them a few gold to be activated.
Everyday, a penguin will show up once a day. When the penguin shows up, player will be able to click the penguin and it will display the upgrades menu. The menu will show a random upgrades that the player can make. But to be able to activate the upgrades, a certain conditions has to be met. That includes the amount of gold player has or if the player achieve a certain number of order, player will be able to activate the upgrades.
The Upgrade
interface helps to activate the specific upgrade when it is called and deactivates it after reaching its time limit.
The UpgradesDisplay
class represents the UI component that displays the available upgrades to the player. It consists of two buttons: ‘YES’ and ‘NO’. It handles the rendering of the upgrades menu, displays the upgrade image, and manages interactions with the menu. The only upgrade that cannot be activated through this menu display is RageUpgrade
.
If the player press YES button but don't have enough gold, the "Not Enough Gold" message will popup and resume the game.
UpgradesDisplay Class Implementation:
UpgradesDisplay(MainGameScreen game)
: Initializes the class with the main game screen reference.void create()
: Sets up the upgrades display UI, loads textures, and initializes buttons.void toggleVisibility()
: Shows or hides the upgrades menu and pauses or resumes the game.void addUpgradeImage()
: Adds an upgrade image to the menu based on the randomly generated upgrade.Table createButtonsTable()
: Creates a table containing the YES and NO buttons for selecting upgrades.void displayNotEnoughGoldUI()
: Displays a UI message indicating that the player does not have enough gold to activate the upgrade.void dispose()
: Unloads resources and cleans up UI elements when no longer needed.void setStage(Stage stage)
: Sets the stage for the display, used to attach UI components.
The RageUpgrade
is the only standalone upgrade that cannot be activated by pressing the penguin. This upgrade activates when the player presses the ‘R’ key, but only if the rage meter is full. When the RageUpgrade
class is activated, it initiates a “rage mode” that boosts the player’s cooking speed, displays a red overlay, and starts depleting the rage meter over 30 seconds. The player can choose to exit “rage mode” early or let it auto-deactivate. Recharging a depleted rage meter takes 1 minute and 30 seconds.
-
RageUpgrade()
: Constructor. Sets up references to game time and initializes internal states. -
void create()
: Initializes the rage upgrade UI components, sounds, and input listeners. -
void setupRedOverlay()
: Creates a red overlay image to indicate rage mode activation. -
void setupRageMeter()
: Sets up the rage meter UI component to show the remaining duration of rage mode. -
void setupInputListener()
: Adds an input listener to activate or deactivate rage mode based on key presses. -
void setStage(Stage stage)
: Sets the stage for the rage upgrade UI elements.
When SpeedBootsUpgrade
is activated, it doubles the player’s movement speed for 30 seconds. However, it requires 20 gold to activate.
-
SpeedBootsUpgrade()
: Constructor. Initializes references to player components and sets default states. -
void create()
: Initializes textures, sounds, and input listeners for the speed boost. -
void setupSpeedMeter()
: Sets up the progress bar to show the remaining time of the speed boost. -
void setupInputListener()
: Adds an input listener to activate the speed boost using a specific key. -
void speedCost()
: Deducts 20 gold when the speed boost is activated. -
void dispose()
: Unloads textures and cleans up resources when the speed boost is no longer needed.
When LoanUpgrade
is activated, it adds 100 gold to the player’s gold balance, providing a financial boost so the player can purchase other upgrades or items.
-
LoanUpgrade()
: Constructor. Sets up references to the player's stats and initializes events.
When the ExtortionUpgrade
class is activated, it temporarily doubles gold earnings from orders. However, it requires an initial payment of 40 gold.
-
ExtortionUpgrade()
: Constructor. Sets up references to player stats and initializes internal states. -
boolean isActive()
: Checks if the extortion upgrade is currently active. -
MainGameOrderTicketDisplay getTickets()
: Retrieves the currentMainGameOrderTicketDisplay
component for modifying order earnings.
When Z
is pressed, the order timing is paused. However, it requires 20 gold to activate, and will only be activated for 30 seconds.
This function will be added to the RandomComboService once the order ticket functionalities are completed.
-
DacePartyUpgrade()
: Constructor. Sets up references to player stats and initializes internal states. -
void dancePartyCost()
: Deducts 20 gold when the dance party is activated.
Activating Upgrades: Upgrades can be triggered in response to player actions or specific game events. Each upgrade listens for specific events via the ServiceLocator.getRandomComboService().getEvents()
handler.
Each upgrade implements conditional logic to check requirements before activation. Most upgrades verify whether the player has enough gold to activate the upgrade. If conditions are not met, the player will see a “Not Enough Gold” display.
Once activated, each upgrade class applies its unique effects, often modifying properties of other game components. The upgrade is automatically deactivated when its duration ends, resetting all properties to their original state.
-
Activate()
: Called when the upgrade is triggered. This function sets the initial values and changes game behavior. -
Deactivate()
: Reverts the changes back to their original states once the upgrade duration ends. -
Update()
: Monitors the states of upgrades, manages their duration, and handles their effects.
- RageUpgrade: Uses a red overlay and plays a sound effect when it is activated.
- SpeedBootsUpgrade: Displays a progress bar indicating the remaining boost time.
Activating upgrades : Upgrades can be triggered in response to the player actions or specific game events. Each upgrade listens for specific events via the ServiceLocator.getRandomComboService().getEvents()
handler.
Each upgrade implements conditional logic to check the requirements before the activation. Most of the upgrades will check whether the player has enough amount of gold to activate the upgrades. If conditions are not met, the player will trigger a “Not Enough Gold” display.
Once activated, each upgrade class applies its unique effects, often modifying properties of other game components. The upgrade is automatically deactivated when its duration ends, resetting all the properties into their original state.
'Activate():' Called when the upgrade is triggered. This function will sets the initial values and changes game behavious. 'Deactivate():' This will revert the changes back to its original states once the upgrade duration ends. 'Update():' Monitor all the states of upgrades and manage its duration and its effect.
The upgrades system provides a way to modify player abilities and interactions within the game temporarily. Each upgrade class implements distinct effects and interacts seamlessly with other game components through event handling and the ServiceLocator
.
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