Tutorial 11: Create an End Screen
Based on the previous tutorial, on our players Step event, we said that when a players lives reach 0 we want the game to go to an end room.
Create an End Room
- Duplicate your game room. Right click on the room in the Asset Browser and click duplicate.
- Rename this room EndRoom1
- Remove all the objects from the Instances layer in the room
– Click on each object and press delete on the keyboard - Make sure this end room is below the game room in the rooms list. If it is not, drag it below it.Let’s now create a button to allow you to restart the game
Create a button to restart the game
There are lots of ways to create buttons. You could use Paint on Windows, Piskelapp.com or any image creation tool. For simplicity, let’s use https://dabuttonfactory.com/
- Go to the above Website
- In the Text box type Re-start Game
- Choose you font and any other text options you like
- Go to the left side of the screen and pick your styles
- Under the button is a Download link. Download the PNG file
- Create a sprite from the button, sprRestartBtn
- Create an object for the Re-start, objRestartBTN
- Add a Mouse Left Pressed Event to the button and add the code:
room_goto(room0); //or whatever your first room is called
- Place the restart button object into EndRoom1
- Test that it restarts the game