I'm playing around with sprites to see how they work and I came across something that doesn't seem right to me and was wondering if I'm doing something wrong, or if it's just the way it is supposed to be.
I have the following code:
rem Portrait App
SetVirtualResolution ( 320, 480 )
// display a background
CreateSprite (1, LoadImage ( "background.jpg" ) )
CreateSprite ( 2, 0 )
SetSpritePosition ( 2, 10, 90 )
// add individual images into an animation list
AddSpriteAnimationFrame ( 2, LoadImage ( "t150x150_1.gif" ) )
AddSpriteAnimationFrame ( 2, LoadImage ( "t150x150_2.gif" ) )
AddSpriteAnimationFrame ( 2, LoadImage ( "t150x150_3.gif" ) )
AddSpriteAnimationFrame ( 2, LoadImage ( "t150x150_4.gif" ) )
AddSpriteAnimationFrame ( 2, LoadImage ( "t150x150_5.gif" ) )
totFrames = 5
// Clone the sprite
CloneSprite ( 3, 2 )
SetSpritePosition ( 3, 161, 90 )
CloneSprite ( 4, 2 )
SetSpritePosition ( 4, 10, 241 )
CloneSprite ( 5, 2 )
SetSpritePosition ( 5, 161, 241 )
// Code Block 1
//PlaySprite ( 2, 1, 0, totFrames, 1 )
//PlaySprite ( 3, 1, 0, totFrames, 1 )
//PlaySprite ( 4, 1, 0, totFrames, 1 )
//PlaySprite ( 5, 1, 0, totFrames, 1 )
// Code Block 2
PlaySprite ( 2, 1, 0, 1, totFrames )
PlaySprite ( 3, 1, 0, 1, totFrames )
PlaySprite ( 4, 1, 0, 1, totFrames )
PlaySprite ( 5, 1, 0, 1, totFrames )
do
Print ( "Strite 2: " + Str(GetSpriteCurrentFrame( 2 )) )
Print ( "Strite 3: " + Str(GetSpriteCurrentFrame( 3 )) )
Print ( "Strite 4: " + Str(GetSpriteCurrentFrame( 4 )) )
Print ( "Strite 5: " + Str(GetSpriteCurrentFrame( 5 )) )
Sync()
loop
If I run it it as is, the animations play and end and display the current or final frame as "5", which makes sense. If I comment out code block 2 and uncomment code block 1, I get very different results. Using code block 2, the sprites play in reverse order, from the final frame to the first frame. This works fine, but when the animation stops, the final frame shows as "5" and not "1" like I would expect.
Is this correct? It makes it a lot more difficult to determine if the sprite was playing forward or backward.