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";
Not sure, but perhaps load the sprite 2, then you can change it using the methods you've used above?
Also, according to H's tutorial here:
Note that this tutorial was made while Kaboom.js was in beta so don't be surprised if the code doesn't work for you.
And you probably have already, but maybe try the documentation here? I tried checking if there was anything about changing sprites, but unfortunately didn't find anything.
Good luck! :D