When loading, I usually do this:
IdleStart = 0
load object "Idle.X", 1
IdleEnd = total object frames(1)
WalkStart = IdleEnd + 1
append object "Walk.X", 1, IdleEnd
WalkEnd = total object frames(1)
But as this has probably nothing to do with your question..
When animating an object and keep it simple, I usually use this method:
if upkey() = 1
if object playing(1) = 0
play object 1, WalkStart, WalkEnd
endif
else
if object playing(1) = 0
play object 1, IdleStart, IdleEnd
endif
endif
Obviously, you can vary a bit. For example, this is extracted from a project I coded for testing some things:
`Controls
if upkey() = 1
if state = 0
stop object 1
set object frame 1, loopStartRun, 50
endif
state = 1
`Move object
posx# = newxvalue(posx#, angy#, MvSpeed#)
posz# = newzvalue(posz#, angy#, MvSpeed#)
else
if state = 1
stop object 1
set object frame 1, loopStartIdle, 50
endif
state = 0
endif
yrotate object 1, wrapvalue(object angle y(1) + mousemovex())
`Animation
if oldstate <> state
if state = 1
if object frame(1) < loopStartRun + 0.5 and object frame(1) > loopStartRun - 0.5
loop object 1, loopStartRun, loopEndRun
oldstate = state
endif
endif
if state = 0
if object frame(1) < loopStartIdle + 0.5 and object frame(1) > loopStartIdle - 0.5
loop object 1, loopStartIdle, loopendIdle
oldstate = state
endif
endif
endif
`Update object
position object 1, posx#, 0.0, posz#
set object speed 1, 35
set object interpolation 1, 5
made sure the transistion between idle and walking was smoothly.
It worked pretty good, though the head rotated the wrong way with the interpolation...
It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.