Tutorial Level & Menus


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.


Last week and this week, I finished the tutorial level for my game and started working on menus.

I have a simple small map with sections that explain different controls or parts of the game that the player should know from the start.


The tutorial level. Ignore the menus/UI objects at the bottom, those are hidden/situated when the game starts.

The first section (first island) of the tutorial tells the player how to move and interact with objects. The second section tells the player how to activate their trash beam/magnet and that they should bring trash to the Recycling Machine. The third section tells the player about how and where Recycled Material is used, and finally the last section tells the player how to pause the game and quit to the menu. Upon typing what each island does, I realize I'm missing a sign on the third island that talks about interacting with and repairing bridges.

Speaking of signs, those are an interactable object I made mostly based on some feedback I got for my game. My playtester got confused with the bridges, with checking only one of the bridge repair costs and assuming the repair costs were the same for all bridges. I wanted to make signs that the player can check and hopefully clear up some confusion when playing the game. I figured using signs for the tutorial would be pretty helpful as well.

The signs function pretty similar to the Fabricator. There's an Area2D that the player can enter and, upon entering, the player is prompted to press the E key (which the graphics have been updated for). When the player presses the E/interact key, it'll show the sign's UI object.

I also partially reworked the menu system so that the player can use the ESC key to close menus/certain UI elements than just clicking the X button (or Continue for the pause menu). It can't be used to close Yes/No prompts though because those are more complicated to remove, but I think it's better that way. I did this by making a global script that handles menus.


The MenuHandling script.


The MenuHandling script set as one of the project's Globals.

The MenuHandling script, as the tin says, handles any menu that's open, and it handles the pause menu. Any objects that have menus will use set_current_menu() to set the current menu. In _process, if there's an active menu, it'll remove that menu (either freeing/destroying it or hiding it). Otherwise, it'll make an instance of the pause menu and set it as the current menu.

The pause menu was originally in the player, but it caused issues because the MenuHandling and Player scripts are, obviously, processed seperately, so hitting escape would remove any menus (if any) through MenuHandling and the ESC action would also pass to the player, causing the pause menu to always be open.

What I want to work on going forward is the settings and main menus. I also need to add that missing sign in the third island of the tutorial level. I will also need to figure out how to save the player's progress when they exit the game.

Get ECO-Keeper