I like chaining tweens but pausing them is problematic.
I'm getting odd things happening, such as the character jumping and moving backwards etc...
Here's the code:
self.tween1 = GTween.new(self, self.travelTime, {x = self.point2}, {onComplete=turn, delay=.1})
self.tween2 = GTween.new(self, self.travelTime, {x = self.point1}, {autoPlay = false, onComplete=turn, delay = .1})
self.tween1.nextTween = self.tween2
self.tween2.nextTween = self.tween1 |
And here's the bit where I'm pausing...
self.health = self.health - 1
self.invincible = true
if (self.tween1:isPaused() == false) then
self.tween1:setPaused(true)
end
if (self.tween2:isPaused() == false) then
self.tween2:setPaused(true)
end
self.anim:setAnimation("WORM_WRAITH_HIT")
Timer.delayedCall(400, function()
self.invincible = false
if (self.tween1:isPaused() == true) then
self.tween1:setPaused(false)
end
if (self.tween2:isPaused() == true) then
self.tween2:setPaused(false)
end |
I'll post the entire code in the next post...
Comments
The problem is you can't pause all tweens in the chain. You have to find out which tween is the current one and only pause that.
In my case I used this in the function that runs after each tween:
Likes: ar2rsawseen