I'm not sure if I'm being dim here but when using the tween system in AGK2 to move a sprite across the screen, how do I tell the tween to use the sprite offset to position it?
e.g.
awidth as integer
aheight as integer
aspect as integer
s as integer
t as integer
awidth = GetDeviceWidth()
aheight = GetDeviceHeight()
aspect = awidth / aheight
s = createSprite(0)
SetSpriteColor(s, 200, 200, 0, 255)
SetSpriteSize ( s , 10 , 10 * aspect )
SetSpriteOffset ( s , 5 , 5 * aspect )
SetSpritePositionByOffset(s, 50, 50)
t = CreateTweenSprite(5)
SetTweenSpriteSizeX(t, 10, 50, TweenLinear())
SetTweenSpriteSizeY(t, 10 * aspect , 50 * aspect, TweenLinear())
// uncomment out the line below
//SetTweenSpriteX(t, 50, 75, TweenLinear())
PlayTweenSprite(t, s, 0)
do
UpdateAllTweens(getframetime())
loop
If you run the above code (assuming I've written it right!), you will see a yellow square slowly expand (in the middle of the screen because it's using the sprite offset) to fill half the screen (horizontally). Uncomment out the line shown, and you will see that the square now moves right but the expansion in size is from the top left corner of the sprite, not the centre as it was previously.
Am I right in thinking this is not expected?
"It is said that your life flashes before your eyes just before you die. That is true, it's called Life.”