Spr
Jump to navigation
Jump to search
spr( n, [x,] [y,] [w,] [h,] [flip_x,] [flip_y] )
- Draws a sprite, or a range of sprites, on the screen.
- n
-
- The sprite number. When drawing a range of sprites, this is the upper-left corner.
- x
-
- The x coordinate (pixels). The default is 0.
- y
-
- The y coordinate (pixels). The default is 0.
- w
-
- The width of the range, as a number of sprites. Non-integer values may be used to draw partial sprites. The default is 1.0.
- h
-
- The height of the range, as a number of sprites. Non-integer values may be used to draw partial sprites. The default is 1.0.
- flip_x
-
- If
true
, the sprite is drawn inverted left to right. The default isfalse
.
- If
- flip_y
-
- If
true
, the sprite is drawn inverted top to bottom. The default isfalse
.
- If
This operation is affected by the draw state.
Examples
-- draw sprite 1 (1x1) at (60, 60)
spr(1, 60, 60)
-- draw sprite 1 (1x1) at (72, 60), flipped vertically
spr(1, 72, 60, 1, 1, false, true)
-- draw the top-left quarter of sprite 1 at (72, 60)
spr(1, 72, 60, 0.5, 0.5)
-- draw sprite range starting at sprite 16, 3 wide 2 high, at (20, 52)
spr(16, 20, 52, 3, 2)