xxxxxxxxxx
24
var anim;
var sprite;
function preload() {
// loads all the image files
anim = loadAnimation('ninja01.png', 'ninja02.png', 'ninja03.png', 'ninja04.png', 'ninja05.png', 'ninja06.png', 'ninja07.png');
}
function setup() {
createCanvas(500, 500);
// change how many frames (of draw loop) each animation frame is
// visible for. bigger #s = slower speed
anim.frameDelay = 6;
// create a sprite from a single image
sprite = createSprite(300, 150);
sprite.addAnimation("ninja", anim);
}
function draw() {
background(255);
drawSprites();
}