It works laugh i am sure this code is not perfect but it works
are there thing i should change about this to make it
a perfect clean code ?

thank you for you help it drove me nuts lol

Code:
ENTITY* walker01;

action moveontrack_01()


{
	var walk_percentage;
	var distance = 0;
	var walking_speed =10;
	VECTOR vecLastposition; 
	VECTOR vecDirection; 
	var vDir[3];
	
	walker01 =me;
	path_set(me, "path_000");
	var nPathLength = path_length ( me ); 

	while(1) 
	{
		path_spline(walker01, my.x, distance);
		vec_diff(vDir,my.x,vecLastposition);
		vec_to_angle(my.pan,vDir);
		vec_set(vecLastposition,my.x);



		

		distance += walking_speed * time_step;
		if ( ( distance < 0 ) || ( distance > nPathLength ) )
		{
			walking_speed *= -1;
			distance = clamp ( distance, 0, nPathLength );
		}
		
		wait(1);
		
		ent_animate(my, "walk", walk_percentage, ANM_CYCLE); // play the "walk" animation
		walk_percentage += 5 * time_step; // "3" controls the animation speed
	}
}



Last edited by Realspawn; 09/01/15 16:38.

Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain