User Guide
Table Of Contents
123
ZSprites is used to store the sprite names in the order that they
should be displayed on the Stage.
The if block checks to see whether the sprite that is second in the
Mobs list has a y position that is less than the item in position one
of the ZSprites list.
1
If it does, then the sprite is lower down on
the Stage and should be displayed in the front, so the script
inserts the second item from Mobs into the first position of
ZSprites. This pushes Billy into second position in ZSprites. If it
does not have a lower y position, the script puts the item in
ZSprites after Billy.
The next if block checks whether the sprite that is third in the
Mobs list has a y position that is less than the first item in
ZSprites. If it does, the script puts this item first. If it does not, the
script checks whether it has a lower y position than the second
item – if it does, the script adds the item to ZSprites as the
1. The item in position one is always the Billy sprite.