Hi there!
I found a bug in the latest version of the GTween plugin. It's a (probably unwanted) result of the "invalid key to 'next'"-bugfix discussed here:
http://www.giderosmobile.com/forum/discussion/2936If you have two tween objects,
and
, and
has an (e.g. "complete") EventListener such as
function() tweenB:setPaused(true) end |
, then it can happen that
won't get paused instantly in the current tick, but only in the next tick. That means,
can still perform an action even after the
call!
The problem lies in the
function:
function GTween.staticTick()
local t = GTween.time
GTween.time = os.timer()
if GTween.pauseAll then
return
end
local dt = (GTween.time - t) * GTween.timeScaleAll
for tween in pairs(GTween.tickList) do
copyTickList[#copyTickList + 1] = tween
end
for i=1,#copyTickList do
local tween = copyTickList[i]
tween:setPosition(tween._position + (tween.useFrames and GTween.timeScaleAll or dt) * tween.timeScale)
end
for i=#copyTickList,1,-1 do
copyTickList[i] = nil
end
end |
All currently unpaused tweens are put into
before
is called, but if one of those tweens gets paused within a
call, the
function will still be called on those paused tweens!
A simple fix for this bug would be to alter the line:
if not tween._paused then tween:setPosition(tween._position + (tween.useFrames and GTween.timeScaleAll or dt) * tween.timeScale) end |
Comments