# lib_draw_sprite
lib_draw_sprite(sprite, subimg, x, y, ?{rot=0, col=c_white, alpha=1})
Source (opens new window)
Draw a sprite to the screen, with all the power
of draw_sprite_ext
(opens new window)
, but with named and optional parameters.
// Without Assistant (Clearly, evil exists.)
draw_sprite_ext(sprite_get("some_sprite"), 0, x, y-10, 1, 1, 0, 2.5, 0.5);
// With Assistant
lib_draw_sprite("some_sprite", 0, x, y-10, {alpha:0.5, rot:2.5})
Parameters:
sprite
: string sprite name OR int sprite id (typically fromget_sprite
(opens new window))
The sprite to load.subimg
: int
The frame of the animation to load.x
: inty
: int
The x and y coordinates of where to draw the sprite.params
struct
A parameter object holding additional sprite modifiers.xscale
: number, default1
yscale
: number, default1
The x and y size multiplier. 1 is normal size, 0.5 is half, etc.rot
: number, default0
The rotation of the sprite. 0 is no rotation, 90 is 90 degrees counter-clockwise.col
: color (opens new window) , defaultc_white
The color to draw the sprite.c_white
is drawn normally.alpha
: number from 0 to 1, default1
The opacity of the sprite. 0 is transparent, 1 is opaque.