so this is my first time even looking at the tween functions. what im trying to do here is use tweening to throw a grenade and have it explode when it reaches the endpoint. it seem that the animation is always playing or not at all.
SetErrorMode(2)
SetWindowSize( 640,360,0,0 )
SetVirtualResolution(1280,720)
SetOrientationAllowed(0,0,1,1)
SetScissor( 0,0,0,0)
SetWindowAllowResize(1)
type explode_type
id as integer
img as integer
blowing as integer
endtype
global explode as explode_type
explode.id = createsprite(0)
explode.img = loadimage("perks/grenada.png")
explode.blowing = 0
setspriteimage(explode.id,explode.img)
setspritevisible(explode.id,0)
setspritesize(explode.id,80,50)
AddSpriteAnimationFrame(explode.id,explode.img)
for i=20 to 49
AddSpriteAnimationFrame(explode.id,(LoadImage("Dynamite/dynoexplode00"+ str(i)+".png")))
next i
tweenGnaid=CreateTweenCustom(1.0)
tweenGnaid2=CreateTweenCustom(1.0)
gnaidchain = CreateTweenChain()
AddTweenChainCustom(gnaidchain,tweenGnaid,0)
AddTweenChainCustom(gnaidchain,tweenGnaid2,0)
x#=0
y#=0
//=====================================================
do
if GetPointerPressed()= 1 and GetTweenChainPlaying(gnaidchain) = 0
SetTweenCustomFloat1(tweenGnaid,0,GetVirtualWidth()/4, 5)
SetTweenCustomFloat2(tweenGnaid,800,GetVirtualHeight()/2,5)
SetTweenCustomFloat1(tweenGnaid2,GetVirtualWidth()/4,GetPointerX(),5)
SetTweenCustomFloat2(tweenGnaid2,GetVirtualHeight()/2,GetPointerY(),5)
setspritevisible(explode.id,1)
PlayTweenChain(gnaidchain)
endif
x#=GetTweenCustomFloat1(tweenGnaid)
y#=GetTweenCustomFloat2(tweenGnaid)
if GetTweenCustomFloat1(tweenGnaid) = GetVirtualWidth()/4 and GetTweenCustomFloat2(tweenGnaid) = GetVirtualHeight()/2
x#=GetTweenCustomFloat1(tweenGnaid2)
y#=GetTweenCustomFloat2(tweenGnaid2)
endif
if GetTweenChainPlaying(gnaidchain) = 1
SetSpritePositionbyoffset(explode.id,x#, y#)
endif
if GetTweenChainPlaying(gnaidchain) = 0 and explode.blowing = 0
explode.blowing =1
playsprite(explode.id,15,0,2,31)
endif
if GetSpriteCurrentFrame(explode.id) = 31 and explode.blowing = 1
SetSpriteVisible(explode.id,0)
StopSprite(explode.id)
SetSpriteFrame(explode.id,1)
explode.blowing = 0
endif
UpdateAllTweens( getframetime() )
Sync()
loop
Edit: i found the issue and it wasnt the tweeing but theres a small delay between the tweens im the chain even with a 0 set