Game Development Reference
In-Depth Information
7. Add a
repeat …
loop, and in the slot, place the
length of <cannon-x>
variable. In this
case, it won't mater which list variable you use because both lists are of equal length.
8. Then, inside the
repeat
loop, change the value of
change <i>
to
1
to start
couning up.
9. Atach a
go to x:... y:...
block.
10. In the empty slot behind the x slot, place an
item
1
of <cannon-x>
block.
11. Place the same block in the y slot, but change the referenced list to
cannon-y
.
12. Replace the fixed numbers with the
i
variable. This will cause the script to step
through the list with each repeat and increase the
i
variable.
13. Finish this script with the important step
create clone of myself
. This should sill
be placed inside the
repeat
loop.
14. Create another script for the created clones staring with a
when I start as a
clone
block.
15. Just like we did with the cannon clones, add a
go to front
block to make sure
the cannonballs are placed above the other sprites.
16. Then, we show the clone to make it visible on the stage.
17. Let them point towards the mouse pointer by using the
point towards
<mouse-pointer>
block.
18. Add a
repeat
loop. The default number of
10
is fine.
19. Inside the
repeat
loop, place a
move
10
steps
block. You can leave the default
number here as well.
20. At the end of the script, outside the
repeat
loop, place a
delete this clone
block.
21. Let's not forget to save the project again. The scripts for the cannonballs allow the
them to be placed and moved across the stage.