Page 114 - Trackpad v5 class 5
P. 114
ADDING ONE MORE SPRITE when clicked
go to x: –50 y: 10
We need one more sprite in the shape of an arrow that will point to the 3 Type SpinningStopped in the New set size to 90 %
wheel to show which section has been chosen. To add one more sprite, message name box and click on OK. forever
Click on Add a Sprite button and select Arrow1 sprite from the library. Arrow1 pressed?
Now click on the OK button. if key space then
repeat pick random 10 to 200
turn 20 degrees
CODE THE WHEEL SPRITE
Now, after adding the sprites and the wheel, we will add the following code for the wheel. broadcast Spinning Stopped
To add the code, follow the given steps:
Step 1 Click on the Wheel sprite and make it active.
Step 2 Click on the Code tab and create the adjoining block stack. 4 Add this block to the code of
Wheel sprite after the repeat block.
when clicked
go to x: –50 y: 10 CODE THE ARROW1 SPRITE
set size to 90 %
forever After broadcasting the message for the wheel, we need to add code when clicked
for the arrow sprite too. To add the code, follow the given steps:
if key space pressed? then go to x: –140 y: 30
Step 1 Click on the Wheel Sprite and make it active.
repeat pick random 10 to 200 set size to 80 %
Step 2 Click on the Code tab and create the given code blocks.
turn 20 degrees
CREATING A VARIABLE FOR THE GAME
To create a variable, follow the given steps:
ADDING BROADCAST BLOCK
2 Choose Make
To send messages between the sprites, use the broadcast block from the Events section. a Variable from 3 Type Winner in the
To add the broadcast block, follow the given steps: the Variables New variable name box.
section.
1 Drag a broadcast message1
block into the code area.
broadcast message1
2 Select the New
New message
Message option from 1 Click on
the drop-down list. Variables block.
message1
4 Click on OK button.
112 Pro (Ver. 5.0)-V

