Step 3 of 4
75%
Shooting arrows
Code your arrow to shoot when the space bar is pressed.
Stop the other script (the one moving the arrow) when the space bar is pressed.
when [space v] key pressed
stop [other scripts in sprite v]
Test your project again. This time, your arrow should stop moving when the space bar is pressed.
Animate your arrow, so that it looks like it's moving towards the target.
when [space v] key pressed
stop [other scripts in sprite v]
+repeat (50)
change size by (-10)
end
Test your game again.
This time, when you press the space bar you should see your arrow get smaller, as if it's moving towards the target.
Once your arrow is at the target, you can tell the player how many points they have scored. For example, they could score 200 points for hitting the yellow.
when [space v] key pressed
stop [other scripts in sprite v]
repeat (50)
change size by (-10)
end
+if <touching color (#ffff00) ?> then
say [200 points] for (2) seconds
end
You can also play a sound if they hit the yellow.
when [space v] key pressed
stop [other scripts in sprite v]
repeat (50)
change size by (-10)
end
if <touching color (#ffff00) ?> then
+start sound (cheer v)
say [200 points] for (2) seconds
end
Finally, you need to broadcast the new arrow message again to get a new arrow.
when [space v] key pressed
stop [other scripts in sprite v]
repeat (50)
change size by (-10)
end
if <touching color (#ffff00) ?> then
start sound (cheer v)
say [200 points] for (2) seconds
end
+broadcast (new arrow v)
JuaraKu