Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [BUG] TweenChains not delaying correctly

Author
Message
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th Apr 2015 13:21
In the simple test below, there are two tweens in a chain.
They are both identical - they fade in a sprites alpha value from 0 to 255 over a period of 1 second.
When the first tween is complete, there is a 2 second delay before the second tween is carried out, so you would expect the sprite to remain fully opaque for those 2 seconds.
However, as you will see when you run the code, the sprite becomes fully transparent as soon as the first tween has finished.



If you increase the delay on the first tween, the sprite disappears the moment the chain is played and doesn't wait for the delay to have passed.

AGK V2 user - Tier 1 & 2
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th Apr 2015 13:26
It seems it isn't just SpriteAlpha that performs like this. I've just tested the code below which moves the sprite, and again, it seems to jump to it's start value before the delay has passed.



AGK V2 user - Tier 1 & 2
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Apr 2015 14:30
I agree, your code is fine and it's doing the same here (2.0.12)

I had the same quandary when I made my own animation/tween system (using the Berps and Lerps you posted many years ago ). Do you set the object to the start point immediately, or when the animation/tween starts? I did it the way you are expecting it to work, and set my objects manually to transparent if it was needed.

It could also be valid to set it the way it works here on a single-tween basis, but when you then create a chain the system falls apart.

If it is by design and won't be changed, then you need to create a dummy tween that goes from 255 to 255, and use that instead of a delay in the chain.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th Apr 2015 17:12
I don't think it is a problem with the tweening algorithms. As you say, they work perfectly when they are not in a chain.
The issue is caused by the chain setting the start attributes of a tween before the time that it should start (according to the delay parameter).
That's something that only Paul could fix but I do like your workaround of creating a dummy tween that occupies the time of the delay.

AGK V2 user - Tier 1 & 2
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 15th Apr 2015 20:00
Fixed for the next version, delays between tweens will leave the target unchanged
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 15th Apr 2015 21:34
Sweet!
Thanks Paul

AGK V2 user - Tier 1 & 2

Login to post a reply

Server time is: 2024-11-25 20:38:59
Your offset time is: 2024-11-25 20:38:59