this is how i manage my player :
like Ortu said my player object have intermediate animations
first i create sequences
type tscen
br `this is the nomber of sequence
frst `first frame of sequence
frend `last frame of sequence
sound `sound of sequence
spid `animation speed of sequence
endtype
function _ScenInit()
dim scen() as tscen
add to queue scen()
endfunction
function _scenar(s,frst,frend,sound,spid)
add to queue scen()
scen().br=s
scen().frst=frst
scen().frend=frend
scen().sound=sound
scen().spid=spid
endfunction
`this functions load all sequences of your animation in program
scene:
_scenar(1,0,20,0,10)
_scenar(2,21,57,1,62)
_scenar(3,58,94,2,80)
_scenar(4,95,115,0,-50)
_scenar(5,116,126,0,-50)
_scenar(6,126,136,0,-50)
_scenar(7,137,157,0,10)
_scenar(8,158,178,0,40)
return
`this is the function that you use while program looping only when it`s triggerd in loop
`(the function sets the current animation of player)
`the values of scen().spid and scen().sound may confuse you but the negative values are used to set the animation on"PLAY" and not on "LOOP"(thats why this values are inside the ABS() brackets)
function _Stejdz(s)
if scen(s).spid>0
loop object 1,scen(s).frst,scen(s).frend
set object speed 1,scen(s).spid
endif
if scen(s).spid<0
play object 1,scen(s).frst,scen(s).frend
set object speed 1,abs(scen(s).spid)
endif
for t=1 to plSounds
stop sound t
next t
if scen(s).sound>0 then loop sound scen(s).sound
if scen(s).sound<0 then play sound abs(scen(s).sound)
endfunction
`Now this is the part that is caculated every loop
ano:
if crouch=0
if crouched=1
scena=5
if object frame(1)>135 and object frame(1)<=136 then crouched=0 `this animation is transition beatvine crouched and stand position
endif
if crouched=0
scena=0 `this animation is stand position
if presha=1 `this variable cheks for keypress
scena=1 `this animation is walking
if shiftkey()=1 then scena=2 `this animation is running
endif
if skok=1 then scena=3 `this animation is jumping
endif
endif
etc.......
`Every time you change the variable scena (that is the Nr of pertiqular sequence) ,this function will be triggerd
if scena<>oldscena
_Stejdz(scena+1)
oldscena=scena
endif
return
I hope this helps you
happy coding