I have found that if I have some enterFrame update loop in my game that prints out debug text nonstop (not a good idea of course), but at the same time I run a function which has nested functions that run based on timer.performWithDelays, in some occasions those nested functions don’t get executed.
For example:
function someFunction()
player.sprite:setSequence( “startSpinning” )
player.sprite:play()
local function speedUp()
player.sprite.timeScale = player.sprite.timeScale*2
end
local function speedDown()
player.sprite.timeScale = player.sprite.timeScale/2
end
local function spinFast()
player.sprite:setSequence( “spinFast” )
player.sprite:play()
end
local function slowDown()
player.sprite:setSequence( “spinSlow” )
player.sprite:play()
end
timer.performWithDelay( 800, spinFast )
timer.performWithDelay( 1600, speedUp )
timer.performWithDelay( 2000, speedUp )
timer.performWithDelay( 2400, speedUp )
timer.performWithDelay( 3900, speedDown )
timer.performWithDelay( 4300, speedDown )
timer.performWithDelay( 4700, speedDown )
timer.performWithDelay( 5100, slowDown )
end
I’m basically trying to make a sprite in game spin faster and slower on certain time intervals. There might be other alternatives to making this happen without incessantly using timer.performWithDelay(), but is there a better way to ensure they’ll all get run? I’ve had cases where the first “speedUp” call doesn’t run and nothing runs afterwards…
Can some other code in enterFrame that runs nonstop make some of the timer.performWithDelay() calls become ignored?