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.
SetWindowSize( 300, 300, 0 )
SetVirtualResolution( 300, 300 )
CreateSprite( 1, 0 )
SetSpritePosition( 1, 100, 100 )
SetSpriteSize( 1, 100, 100 )
tween1 = CreateTweenSprite( 1 )
SetTweenSpriteAlpha( tween1, 0, 255, TweenLinear() )
tween2 = CreateTweenSprite( 1 )
SetTweenSpriteAlpha( tween2, 0, 255, TweenLinear() )
chain = CreateTweenChain()
AddTweenChainSprite( chain, tween1, 1, 0 )
AddTweenChainSprite( chain, tween2, 1, 2 )
do
UpdateTweenChain( chain, GetFrameTime() )
if GetPointerPressed()
PlayTweenChain( chain )
endif
Sync()
loop
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