ok so I'v ben working on this all day and can not come up with a working solution...I have a realy nice animated sprite that I want to make walk across the screen useing user input...I want the sprite to be animated when moveing and not when not moveing... I have tryed every thing I can think of and the best results I get are 1 animated cycle plays after the sprite has moved "often some distance depending on how long the arrow key was held down...
PLEASE HELP
*EDIT
code fixed and running better than I dreamed...
thank you Hodgey,Hockeykid and Simpleprogram...
code updated for anyone who wants to see it...
//
rem AGK Application
rem AGK Build 107
//
// Project# 002
// version 1.5
// Last Revised 12-31-12
rem Landscape App
SetDisplayAspect( 4.0/3.0 )
SetVirtualResolution (640 , 480 )
rem background
backdrop = CreateSprite ( LoadImage ( "testbackground1.png" ) )
rem load music into ID slot 1
LoadMusic ( 1, "01 Footsteps FX.mp3" )
rem Set Sprite variables X&Y
X#=23.00
Y#=344.9
rem create sprite
CreateSprite ( 1, 0 ) // create a sprite with ID that has no image
SetSpriteOffset(1, getspritewidth(1)/2 , getspriteheight(1)/2 ) // sets sprites X&Y to center
SetSpritePosition ( 1, x#, y# )
rem add individual images into an animation list for Sprite 1
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws2b.png" ) )
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws3b.png" ) )
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws4b.png" ) )
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws5b.png" ) )
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws6b.png" ) )
AddSpriteAnimationFrame ( 1, LoadImage ( "Godzilla_rws1b.png" ) )
rem play the animated sprite
PlaySprite ( 1, 10, 0, 1, 6 )
rem play and loop the music
PlayMusic ( 1, 1 )
rem Main Program Loop
do
rem show debug statistics for X and Y
print(" X position = " + str ( GetSpriteX(1)))
rem get input and move sprite
Dirx# = GetDirectionX()
if Dirx# > 0.5
if getSpriteCurrentFrame(1) >= 6
PlaySprite ( 1, 10, 0, 1, 6 )
SetSpriteActive(1,1)
setspriteflip(1, 0, 0) // resets sprite flip to start if necessary
endif
x# = x# + 1.0
setspriteposition(1,x#,y#) // update sprite position
endif
if Dirx# < -0.5
if getSpriteCurrentFrame(1) >= 6
PlaySprite ( 1, 10, 0, 1, 6 )
SetSpriteActive(1,1)
setspriteflip(1, 1, 0) //flip the sprite to make it seem like its facing the other way
endif
x# = x# - 1.0
setspriteposition(1,x#,y#) // update sprite position
endif
Sync()
loop