The_Official_Raspberry_Pi_-_Beginner’s_Book_Vol1,_2018 (1)

(singke) #1

(^82) THE OFFICIAL RASPBERRY PI BEGINNER'S GUIDE
To create more swimmers, add a repeat 6 block – changing from the default value of ‘10’



  • and add a create clone of myself Control block inside it. To make it so the swimmers aren’t
    all swimming in the same direction, add a turn  60 degrees block above the create clone
    block but still inside the repeat 6 block. Click the green flag, and try the arrow keys now to
    see your swimmers come to life!


when left arrow key pressed
switch costume to left

turn^15 degrees

when right arrow key pressed
switch costume to right

turn^15 degrees

when up arrow key pressed
move^10 steps

when down arrow key pressed

move -10 steps

when clicked

gotox:^0 y:^0

point indirection^90
repeat^6

turn^60 degrees

create cloneof myself
Free download pdf