Synchronizing with broadcasts

Initializing Values

I am not showing the several smaller initialization scripts for each of the sprites. If you build the scripts I have referenced, you will discover the necessary initializations as you play through the game. There are a couple of rules being observed that may help you fill in the missing scripts. If the player is walking, neither the Ball nor the sprite is visible.

However, when the sprite displays and is ready to be captured with the Ball, the player sprite is hidden. Hiding the player represents a first person view, and it also gets the player sprite out of the way so that there's no chance it will conflict with the placement of the Ball. Remember that anytime you change variables or how a sprite looks, you will want to think about resetting values, especially when you use those variables throughout the game to trigger events.

Building on the Framework

I've provided a playable framework upon which you can build. Obviously, you could add more features to mimic the real game, such as limited number of Balls. My son tells me that in the game you can also run away when you don't want to capture the sprite. If you're a true fan, you might be interested in displaying the stats for each sprite you catch. There's a lot of opportunity to add your own flare and create a more robust game.

Happy Scratchin'!

The Author

Michael Badger wrote the Scratch 1.4 and 2.0 Beginner's Guide series from Packt Publishing. Learn more at http://scratchguide.com

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content