How would you recommend to control the speed of an animation? For example of the animations I have is walking, however I was planning to migrate from my spritesheet approach where by as the player starts walking faster the animation speed increases. So therefore need a way in the game loop to set a new "animation speed", which I will calculate myself in the game loop.
What's the best way of doing this? (e.g. just create a timeDilationFactor type variable and apply to the "delta" time in the game loop? or is the a more elegant way?)
i.e. game loop being:
local lastTime = 0
Runtime:addEventListener("enterFrame", function (event)
---
Compute time in seconds since last frame.
local timescale = 1.0
local currentTime = event.time / 1000 * timescale
local delta = currentTime - lastTime
lastTime = currentTime
skeleton.group.x = parentGroup.x
skeleton.group.y = parentGroup.y
state:update(delta)
state:apply(skeleton)
skeleton:updateWorldTransform()
end)