Well, your restarting the whole animation everytime you press a key, use something like:
do
if upkey()=1
if mode<>1 then loop object 1,670,720 : mode=1
move object 1,20
endif
sync
loop
This will store the movement mode in the variable 'mode', use different numbers for different directions, basically you need to know if the object is already looping; for example, to check for forward and backward movement:
do
moving=0
if upkey()=1
if mode<>1 then loop object 1,670,720 : mode=1
moving=1
move object 1,20
endif
if downkey()=1
if mode<>2 then loop object 1,720,670 : mode=2
moving=1
move object 1,-20
endif
if moving=0 then stop object 1
sync
loop
Now because the animation handling is more advanced, it's a good idea to keep control of movement, using a 'moving' variable, if it's one then the object is moving, if it's 0 then the object is still - so you can stop the animation when you stop moving, you'll probably want to go into the idle animation instead of just stopping, so you could replace the moving line with:
if moving=0 and mode<>-1 then Loop object 1,1,150 : mode=-1
This is not usually how I'd handle animation, I'd most likely store all the animation details in arrays and have a more complex mode system, a lot of setting up but it sorta keeps itself smooth and is easier to code around, instead of worrying about keeping track of frames etc, I'd just set the mode to suit what was happening to the character. This is not really for beginners, but why not try and come up with a system that does more for itself, a good place to start is an array of frame start and end positions, and a record of the object mode and frame numbers, you might find this approach actually saves a lot of time in the long run.
Van-B
I laugh in the face of fate!