I'm on Windows SDK.
Question:
- I'm trying to animate my sprites, but I'm not sure how to hook into the sprite update effectivly. I know if I have one sprite, I can add a function for that sprite something like this works.
local x
x = gfx.sprite.new()
x:add()
function x.update()
print("TEST")
end
However, if I do something like this, I'm not sure how do hook into that update.
local sprites = {}
sprites[1] = gfx.sprite.new()
sprites[1]:moveTo(275, 100)
sprites[1]:setImage(spriteImage)
sprites[1]:setZIndex(Layers.Layer2Middle)
sprites[1]:add()
I suppose I COULD just make them individual sprites, but I was hoping there was a way to get hold of that sprite in the array so I'll know when it gets updated.
Something I tried:
I did try doing this, and technically it did work, but the simulation locked up because it was to busy updating.
function gfx.sprite.update()
print("This worked, but didn't")
end