O'Reilly logo

Raspberry Pi For Dummies by Mike Cook, Sean McManus

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding Scripts to the Stage

As well as sprites, you can add scripts to the Stage. Click the Stage in the Sprite List, and you’ll find it has its own Scripts Area. It’s a real pain to have to hunt through your sprites to find where you put a particular block so you can change it, so this is a good place to put scripts that affect the whole game and that aren’t associated with a particular sprite.

For this game, we should add a block to the Stage to set the score to 0 when the green flag is clicked. Otherwise, the score will rise ever higher with each successive game and will never be set back to zero when a new game starts.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required