while i agree the animation should set its next frame immediately when you change frame ranges, apparently dbpro needs to finish it's current range of frames before moving on. so, you would need to set it manually. see the
if statement(s) and new variable
currmove (current movement direction) added to your initial code:
sync rate 60
global sammy = 1
global playerx = 300
global playery = 400
set image colorkey 255,0,255
create animated sprite sammy,"sammy.bmp",8,2,sammy
do
if leftkey()
if currmove <> -1
set sprite frame 1,8
endif
play sprite sammy,1,8,100
playerx = playerx - 2
currmove = -1
endif
if rightkey()
if currmove <> 1
set sprite frame 1,9
endif
play sprite sammy,9,16,100
playerx = playerx + 2
currmove = 1
endif
sprite sammy,playerx,playery,sammy
sync
loop
yah, i also moved the
sprite call to the bottom of the loop to ensure the correct frame was appearing as soon as it was set (that's the theory anyway.
). also, you had an extra endif in there...