Difference between revisions of "SpriteDisplay.sprites"

From MiniScript Wiki
Jump to navigation Jump to search
(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...")
 
m
 
Line 1: Line 1:
<c>SpriteDisplay.sprites</c> is the list that contains all sprites in the display.  Sprites are
+
<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  
 
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
 
back, and the last sprite in the list drawn on top.  To add a sprite to

Latest revision as of 16:26, 27 April 2020

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