In this add-on, you will add a starting screen that displays the name of your game and instructionsfor 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 instructionsfor the user on how to play your game. Use the brush, line, rectangle, and ellipse toolsto decorate your starting screen. This is just an example. Create your own startingscreen 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 “whenflag 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 clicksthe stage. Open the “events” menu, and add a “when stage clicked” block. Underthat, add a “switch backdrop to” block. Select a backdrop for your game to be playedon. This example will use the “dirt” backdrop.
Finally, replace the “when flag clicked” blocks in the racer and obstacle sprites withthe “when backdrop switches to” block. Make sure your game backdrop is selected inthe dropdown. In the example, it’s dirt. Test your code. Great! The game begins onthe start screen, but the game doesn’t start properly when the stage is clicked. It seemsto be lagging. There is a bug in this program.
Click the racer sprite and look at the code. Notice that there is a “switch backdropto dirt” block right underneath the “when backdrop switches to dirt” block. Becauseof this, the event “when backdrop switches to dirt” runs over and over again, preventingthe game from starting. Remove the “switch backdrop to dirt” block, then test yourcode 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 backdropto” blocks. Make your game start when the user clicksthe stage using a “when stage clicked” block, a “switch backdrop to” block, anda “when backdrop switches to” block.
Choose an Add-On
Add a starting screen with instructions for your game.
Keep track of how long a racer stays alive and display the score.
Create a sprite that cheers on the racer.
Program your racer to do a cool trick at the press of a button.
Create a power up that shrinks the racer.
Add a sound that plays when the racer crashes into an obstacle.