SpriteDisplay.sprites
Revision as of 21:38, 12 April 2020 by ZachStrout (talk | contribs) (Created page with "<c>SpriteDisplay.sprites</c> is the list that contains all sprites in the display. Sprites are layered according to their order in this list, with sprites[0] at the back, an...")
SpriteDisplay.sprites
is the list that contains all sprites in the display. Sprites are
layered according to their order in this list, with sprites[0] at the
back, and the last sprite in the list drawn on top. To add a sprite to
the display, simply add it to this list; remove it from the list to remove
the sprite from the display. You may reorder
sprites in this list at any time to change the layering.
Example
sp = new Sprite
sp.image = file.loadImage("/sys/pics/Wumpus.png")
display(4).sprites.push sp // add a sprite to the display
key.get // wait for a keypress
display(4).sprites.remove display(4).sprites.indexOf sp // remove it