SpriteDisplay.sprites

From MiniScript Wiki
Revision as of 16:26, 27 April 2020 by JoeStrout (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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