I'm doing one FPS tutorial. it's a bit old and probably for C-Script, but I'm doing quite well coding it in LiteC. Now I have bumped into a problem. There is a code for reversing the animation. It seems logical enough but doesn't work for my model.
It's from inside the action:
while (player != NULL)
{
spdx = (key_w - key_s) * 3 * time_step; //walking speed
[..]
//Animation control
if (spdx == 0 && spdy == 0) //If no movement
{
walk_percent = 0;
//Works great
idle_percent = (idle_percent+5*time_step)%100;
ent_animate(me,"stand",idle_percent,ANM_CYCLE);
}else{
idle_percent = 0;
//Doesn't work!!!
walk_percent = (walk_percent + sign(spdx)*6*time_step)%100;
//walk_percent = (walk_percent + sign(move_vec[0])*5*time)%100; //Original code from Tutorial
ent_animate(me,"walk",walk_percent,ANM_CYCLE);
}
wait(1);
}
[..]
Any idea what's the case? My model has 8 walk frames. My model walks forward nicely but when it's going back it doesn't do the animation only the first walk frame is shown although the walk_percent runs nicely!