Aloha!
For day 5 of my work through the 2D game development course the focus of the subjects were on further developing the visual and audio elements of the game. With the mechanics of damage, scoring, powerups, and a lose condition in place we need a way to communicate to the player how they are doing in the game, to do this we will need to develop an UI, short for User Interface. This is the part of the game that displays important information to the player along with presenting utility functions such as menus and instructions.
With the game that is being developed for this exercise being rather simple there were only a few key pieces of information that we needed to convey to the player, those being their score and their remaining lives. Presenting the score to the player required creating a canvas that would house and display all necessary UI elements for the scene as well as create a text object that would display the player’s current score. This text would then be updated every time the player destroys an enemy with their laser by increasing its total by an increment of 10. Displaying the amount of lives the player has was handled by creating an image object that would update which sprite it presents as the player takes damage.
The following UI elements that were needed were ways for the player to know that the game was over and how to restart the game. This was simply done by creating text that would activate and deactivate repeatedly to present a flickering effect once the player runs out of lives. Additionally further text would be presented to tell the player to press the R key to reload the game scene.
Finally with the UIfor the main game being completed we also needed to implement a main menu that would introduce the player to the game and allow them to start playing at their own volition rather than diving straight into gameplay once the game is loaded.
This required making a separate scene for the game and creating a clickable button that will load in the scene for the game.
With the basic UI in the books the next step was to implement animations and other visual effects for the enemies and other parts of the game. This involves things such as adding an explosion effect to the enemies when they are destroyed.
At the point of this writing the next steps are adding in an interactable asteroid to the scene that we can use to control the spawning of the enemies as well as adding thrusters to the player as they move.