Corona SDK: Animation takes a long time to play after "prepare" step
- by Michael Taufen
First off, I'm using the current publicly available build, version 2011.704
I'm building a platformer, and have a character that runs along and jumps when the screen is tapped. While jumping, the animation code has him assume a svelte jumping pose, and upon the detection of a collision with the ground, he returns to running. All of this happens.
The problem is that there is this strange gap of time, about 1/2 a second by the feel of it, where my character sits on the first frame of the run animation after landing, before it actually starts playing. This leads me to believe that the problem is somewhere between the "prepare" step of loading up a sprite set's animation sequence and the "play" step. Thanks in advance for any help :).
My code for when my character lands is as follows:
local function collisionHandler ( event )
if (event.object1.myName == "character") and (event.object2.type == "terrain") then
inAir = false
characterInstance:prepare( "run" ) -- TODO: time between prepare and play is curiously long...
characterInstance:play()
end
end