I got a problem with my movement system. I can't implement animations for my jump. I tried it with "ent_animate(my, "jump", jump_percentage, NULL);" but it never worked well. Anyone got a Idea how I can implement a animation into my jumps?


Here is my movement code: (jump is at the end)
Code:
action guard_with_pointer()
{
//Parameter
var movespeed = 5.0;
var fallacc = 4;
var jumpacc = 18;
var death_percentage;
var jump_percentage;
var attack_percentage;
var walk_percentage;
	
//Temporare
VECTOR movedir;
vec_set(movedir, vector(0, 0, 0));
ANGLE rotdir;
vec_set(rotdir, vector(0, 0, 0));
var grounddist;
	
//Check unit height
guard1 = my; 
wait(1);
var feedheight = -my.min_z;
	
//While
proc_mode = PROC_EARLY;
while(1)
{
ent_animate(my, NULL, 0, 0); // Animation reset 

//*********** Movement system ********************
	if (my.pan == 90)
	{
	        //Check key pressed
		movedir.x = (key_cul-key_cur)*(1+key_shift);
		movedir.y = key_cud-key_cuu;	
		
		//Calculating movementspeed
		movedir.x *= movespeed*time_step;
		movedir.y *= movespeed*time_step;
		
		//Moving
		c_move(my, vector(movedir.x, movedir.y, 0), nullvector, GLIDE|IGNORE_PASSABLE);

		//Ceck distance to ground
		grounddist = c_trace(my.x, vector(my.x, my.y, my.z-10000), IGNORE_ME|IGNORE_PASSABLE)-feedheight;
		if(grounddist > 0 || movedir.z < 0)
		{
			//Fall accelerating
			movedir.z += fallacc*time_step;
		}
                else
		{
			movedir.z = 0;
		}
	
		//Use of fall accelerating
		my.z -= minv(movedir.z*time_step, grounddist);
		
		if(grounddist-minv(movedir.z*time_step, grounddist) == 0)
		{
			//Jump
			if(key_space)
			{
				movedir.z = -jumpacc;
			}
		}
	}




1338, beyond leet.