Skip to content

Create a sprite

Julien Tauran edited this page Dec 28, 2018 · 6 revisions

A sprite is defined as an object named "bs_sprite_t".
A sprite is normally a static image, but you can animate it by adding custom animation.

To create a sprite you will have to choose an id (must be unique) and a texture path.
bs_sprite_t *sprite = bs_sprite_create("sprite id", "texturepath/image.png");

A sprite animation is defined as an object named "bs_sprite_anim_t".
An animation can be looped and stay on last frame. Its speed can also be adjusted. To create a sprite animation, you will have to choose an id, a texture path, an height and a width.
bs_sprite_anim_t *anim = bs_sprite_anim_create("anim_test", "./example/res/sprite_sheet.png", 100, 100);

Clone this wiki locally