sprite.playAnimation

Section: Sprite Animation

What it does

sprite.playAnimation plays Animation on a sprite object. It takes id and name.

Signature

sprite.playAnimation(id, name)

Arguments

  • id
  • name

Example · generated

function start() {  const id = sprite.create('/sprites/hero.png', 100, 120);  sprite.playAnimation(id, 'main');}

sprite.create is there to give the call something to act on; sprite.playAnimation is the line that matters. The code sits in start(), which the engine calls once, when the entity spawns.

49 members in sprite