Activity 10 - Adding a Title Screen
Now, we will put our separation of scene 1 and scene 2 to good use by adding a title screen to finish off our game!
This is very simple! we will first comment out startGame()
line from the bottom of create()
in Scene 1
. We are going to use startGame()
function to start game instead of start automatically as before:
The console will go back to a black canvas. To make a title screen, we need to import the background screen and some text in start page
section from scene 1:
You can only create background as an image in create()
, because images can only be moved in update()
functions!
For the texts, We would recommend different font
and fills
for title text and start text.
Now, we will call the startGame()
method only if the player clicks to start the game:
Your screen should look similar like this:
Congratulations!
You have now compeleted all the lessons and created your own space invader game! Have fun with it! 👏🏽👏🏽👏🏽
You did it!
Workshop completed!