Raspberry_Pi_Education_Manual

Notes:

Prancing Pony game

Resources: The sprites: “ pony ” and “ girl ” and the background “ field ”. The aim of the game: A pony moves around a field, making random changes of direction. Using the mouse, the player controls the girl sprite. To score points, you must put the girl on the pony.

There are four tasks for you to program:

1. Move the pony round the field. 2. Make random changes in direction of the pony. 3. Move the girl with the mouse pointer. 4. Add a point to the score each time the girl is placed on the pony.

So, let’s get to it!

Moving the pony

1. Keeping the pony moving

Select the pony sprite and drag a green-flag event to the Scripts tab. We will use the green flag event to run all the scripts in this game at the same time.

We have used a “forever” loop to keep our pony moving (remember your LFV). For each cycle of the loop, the pony moves forward 3 steps. If it hits the edge of the screen it will bounce off in the other direction; this prevents it from getting stuck.

A beginner’s guide to Scratch

45

Made with FlippingBook flipbook maker