What it does
sprite.setAnimation sets Animation on a sprite object. It takes id, name, start, end, fps and loop. fps and loop are optional.
Signature
sprite.setAnimation(id, name, start, end, fps?, loop?)Arguments
idnamestartendfpsoptionalloopoptional
Example · generated
function start() { const id = sprite.create('/sprites/hero.png', 100, 120); sprite.setAnimation(id, 'main', 1, 1);}sprite.create is there to give the call something to act on; sprite.setAnimation is the line that matters. The code sits in start(), which the engine calls once, when the entity spawns.