Game Development Reference
In-Depth Information
3.
Use
Make a List
again and call it
cannon-y
.
4. The lists should be empty at the start of the game. To ensure this is the case,
we will add a script to the
Stage
that empies the list.
5. Start a new script in the
Stage
with a
when <green lag> clicked
block.
6. Add a
repeat …
loop for a limited number of repeated acions.
7. Place a
delete … of <cannon-x>
block inside the repeat loop.
8. Select
1
or the first item in the list to be deleted. This way, the first item in the
list will be stripped and the second item will become the first for the next repeat
in the loop.
9. We want to repeat the loop as many imes as there are items in the list.
So in the number slot, place the
length of <cannon-x>
variable. This variable
stores the number of items stored in the list.
10. Right-click on the
repeat
loop and choose
duplicate
to make a copy of the acions.
11. Atach the copied loop to the irst one.
12. Change all references from
cannon-x
to
cannon-y
to perform the same acions on
the other list.