arrow_back Change Up your Racetrack
Racing around the same old track all day could get pretty boring. Use this add-on to change up the venue for your racing sprites. In this video, you’ll learn how to add a button that you can program to change between the three racetrack backdrops available in the starter project. Watch how it’s done first, then try it on your own.
To start, choose a sprite to be the button for this project, for example, “button 1” like you see here. You can choose any sprite you want for your project.
This button is pretty large, so use the shrink tool to make it smaller, and drag it into the corner of the project. Next, program the button to change backdrops.
Click on looks, select the “switch backdrop to” block, and change the value to “next backdrop.” The backdrops now change when the block is clicked.
Finally, add an event that tells the computer to run this code. The backdrop should change when the sprite is clicked. To make that happen, add a “When this sprite clicked” event.
Try it out! Remember, it’s important to test your code at every step along the way--that’s what computer scientists do to make sure everything is working the way they want it to.
Awesome, the user can click this button to choose a backdrop.
When you are finished, add instructions to the project page to tell your users how to use the new feature. Now, it’s your turn: Add a sprite. Change the backdrop using a “switch backdrop” block and a “when sprite clicked” event.