Character Animation Control

Blitz3D Forums/Blitz3D Beginners Area/Character Animation Control

Uh, perhaps OpenDNA directory ? Again, under Blitz3D\Samples\Blitz 3D Samples\

Note that the example uses a .MD2 model, so if you do a search of *.MD2 from the main B3D samples directory, you should find it.

I recall Reda because it's the name of the author of the example (Reda Borchart I guess)

Anyway, looking at your code, I see that you use KeyHit for jump, and KeyDown for run animation. The running animation works because using keydown, you constantly animate the model, while using keyhit, you do this only once.

Bare in mind that the model should constantly be animated, so to speak; is not enough to call once the animation statement, you have to do at each frame - and so you do with the running animation, thanks the use of keydown.

So, you may better use a flag, and constantly set the animation as you do with the running one:
const A_RUN = 1
const A_JUMP = 2
global anim

;
;character control
anim = 0
if keydown(run_key) then anim = A_RUN
if keydown(jump_key) then anim = A_JUMP

;
;
;in your main loop
select anim
case A_RUN
If (currentanimframe < 40) Or (currentanimframe > 46) AnimateMD2 model, 1, 0.1, 40, 46, 2 ;RUN ANIMATION (FORWARD ARROW)


case A_JUMP
If (currentanimframe < 67) Or (currentanimframe > 72) AnimateMD2 model, 3, 0.1, 67, 72, 2 ;JUMP ANIMATION (SPACE BAR)

end select



Does he jump now ?

:)

Sergio.