Fabricator & Player Upgrades
The following is part of a bi-weekly update we would be required to do as we worked on our final projects. Some things may require context that is not included or some original post content may be excluded.
This week I had been able to implement the shop (with player upgrades), I added the first kind of trash pile, and I fleshed out the first area of the game.
How the shop works is that it keeps track of the player body when they are currently within the shop's area/hitbox. This makes it so the shop can access the player's balance and upgrade their stats should they be able to buy any upgrades.
Very simple functions that are run when the shop's Area2D sends out signals when the player enters and leaves the area. These functions also send out signals which are connected to the main game's script which just allows the game to show/hide the prompt that shows the player what button to press to interact.
The shop has a simple menu that comes up when you interact with it.
The shop, or the Fabricator, menu.
Pressing any of the buttons within the shop will make those buttons send signals to the actual shop scene, as the shop menu is a child scene of the actual shop.
This is the script for the ShopMenu scene. The buttons are connected to their respective functions and, when pressed, will send signals that the parent scene/script (in this case, the Fabricator) can connect to so that the parent does not need to access its grandchildren scenes directly.
Here are a couple of the signals that are connected to the Fabricator script. These functions that the signals activate handle the actual processing of shop purchases the player may make.
With the shop set up, the player has also had some upgrades added to them:
- The beam upgrade upgrades the strength of the beam, which is needed to break down trash piles into trash the player can pick up and recycle, with the max level being 3. This stat is used when creating the player's trash magnet as that is what actually collides with the trash piles.
The TrashMagnet _process function. It's been updated to detect TrashPile objects and to call their deal_damage function.
The TrashPile script. It has variables that determine whether it'll get damaged or not. When the TrashMagnet calls the deal_damage function, it passes in its current level (which is set by the player) and a damage number. If the level is greater than or equal to the TrashPile's _level_needed, it'll get damaged. Once it's destroyed, it'll spawn a random number of Trash objects which the player can then collect.
- The magnet upgrade allows the player to carry/pull-in more trash at a time. The max level allows the player to carry/pull-in 10 trash at a time.
- The trash tracker allows the player to see how clean an area is. There is currently a work-in-progress mechanic where trash will occassionally spawn in areas that have not been completely cleaned, so if the area is not 100% clean, more trash will gradually spawn until the player is able to clean the area 100%.
There is also one more upgrade planned for the player that I have not implemented yet and that is the trash compass, which will lead the player in a direction to the closest trash/trash pile that they can collect if they are within range of one.
What I want to work on now is adding new trash pile variants (ones that need a higher level and more sprites that the piles can vary from). I also want to work on potentially setting up the second area, getting the starting area to be trackable with the trash tracker, and refining the trash tracker in general. I may also want to work on the trash spawning mechanic.
Get ECO-Keeper
ECO-Keeper
Play as a little robot tasked to clean the planet!
Status | Prototype |
Author | StarsproutGames |
Genre | Adventure |
More posts
- Save/Load Functionality4 days ago
- Save Slot Menu4 days ago
- The Main Menu4 days ago
- Finishing the Settings Menu4 days ago
- Making a Settings Menu4 days ago
- Tutorial Level & Menus4 days ago
- Trash Piles & Trackers4 days ago
- First Unlockable Area4 days ago
- Start of a New Project4 days ago