arrow_back Start Screen
In this add-on, you will add a starting screen that displays the name of your game and instructions for how to play. To start, select the stage, then open the “backdrops” tab. Click the “Paint new backdrop” icon. It looks like a little paintbrush.
Then, use the text tool to write a title for your game. Underneath it, write instructions for the user on how to play your game. Use the brush, line, rectangle, and ellipse tools to decorate your starting screen. This is just an example. Create your own starting screen to kick off your game. It can be as simple or as fancy as you like.
Name your backdrop “start screen” so you can easily find it in the next step.
Next, program your game to start on this backdrop. Click on the “scripts” tab. Add a “when flag clicked” block, then go to “looks” and add a “switch backdrop to” block.
Click the down arrow, and select “start screen.”
Test your code by clicking the flag. Great! The backdrop switches to the start screen, but the game also starts. Program the game to start when the user clicks the stage. Open the “events” menu, and add a “when stage clicked” block. Under that, add a “switch backdrop to” block. Select a backdrop for your game to be played on. This example will use the “dirt” backdrop.
Finally, replace the “when flag clicked” blocks in the racer and obstacle sprites with the “when backdrop switches to” block. Make sure your game backdrop is selected in the dropdown. In the example, it’s dirt. Test your code. Great! The game begins on the start screen, but the game doesn’t start properly when the stage is clicked. It seems to be lagging. There is a bug in this program.
Click the racer sprite and look at the code. Notice that there is a “switch backdrop to dirt” block right underneath the “when backdrop switches to dirt” block. Because of this, the event “when backdrop switches to dirt” runs over and over again, preventing the game from starting. Remove the “switch backdrop to dirt” block, then test your code again. Cool! Now the game begins on the start screen, and the game starts properly when the user clicks the stage.
Here’s the game plan! Paint a starting screen backdrop.
Make your game start on the start screen using “when flag clicked” and “switch backdrop to” blocks. Make your game start when the user clicks the stage using a “when stage clicked” block, a “switch backdrop to” block, and a “when backdrop switches to” block.