Sprite

From MiniScript Wiki
Revision as of 17:27, 19 March 2020 by JoeStrout (talk | contribs) (Created page with "<c>Sprite</c> is a built-in class in the Mini Micro API. It represents an image which can be added to a SpriteDisplay, enabling it to be drawn to the screen very effi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Sprite is a built-in class in the Mini Micro API. It represents an image which can be added to a SpriteDisplay, enabling it to be drawn to the screen very efficiently while also being scaled, rotated, or tinted, and layered consistently with other sprites and the surrounding displays.

Example

This example creates a sprite, loads it into display 4 (which by default is a SpriteDisplay, and rotates it through 360 degrees.

spr = new Sprite
spr.image = file.loadImage("/sys/pics/Wumpus.png")
display(4).sprites.push spr
spr.x = 480
spr.y = 320
for r in range(0,360)
   spr.rotation = r
   yield
end for