The_Official_Raspberry_Pi_-_Beginner’s_Book_Vol1,_2018 (1)

(singke) #1
Chapter 4 Programming with Scratch^85

THE OFFICIAL RASPBERRY PI BEGINNER’S GUIDE


when left arrow keypressed
switchcostume to left
turn^15 degrees

when right arrow keypressed
switchcostume to right
turn^15 degrees

when up arrow keypressed
move 10 steps

when down arrow keypressed
move -10steps

when clicked
gotox: 0 y: 0
pointindirection^90
repeat^6
turn^60 degrees
create cloneof myself

when clicked
forever
playsound dance around untildone

when space keypressed
switchcostume to right
repeat^36
turn^10 degrees
move^10 steps

Click the green flag to start the program, then press the SPACE key to try out the new routine
(Figure 4-20, overleaf)! Don’t forget to save your program when you’re finished.

Free download pdf