Changing the sprite of an object in kaboom.js
I have an object
var nark = add([ sprite("spr_1") ]);
How might I change the sprite to something different programatically? Ive tried both of these, but to no avail:
nark.sprite = sprite("spr_2"); nark.sprite = "spr_2";
Like JamesHolmstrom wrote, for this one would use changeSprite.
But thought I'd just like to add that if its to change the image of a tilemap, then you can set the frame no. directly on the GameObj:
mark.frame = 4