Skip to content

2. Loading Sprites

sean_codes edited this page Jan 6, 2017 · 1 revision

Sprites are stored in the _sprites folder and automatically loaded by the load.php.

The file name is used to define properties of the sprite

[spr_name]-[frames]-[width]-[height]-[x-origin]-[y-origin].png

This will be loaded:

 cs.sprite.add('spr-1-32-48-0-0','path/spre-1-32-48-0-0.png')

This image will now be usable:

 cs.draw.sprite('spr', frame, x, y);

Use -1 as the frame argument to animate the sprite.

Clone this wiki locally