Working

flip_rate = highvaule == slow change or lowvalue == fast change

OLD CODE WITH BUG
Click to reveal..
Code:
action my_action()
{
	set(my,SHADOW|CAST);
	var dist_to_move=0;
	var skin_count=0;
	var vSpeed=2;
	int flip_rate=18;
	while(1)
	{
		
		dist_to_move=(vSpeed*flip_rate)*time_step;
		skin_count+=(vSpeed*time_step)/dist_to_move;
		skin_count%=3;
		c_move(my,vector(vSpeed*time_step,0,0),nullvector,GLIDE);
		my.skin=integer(skin_count);
		wait(1);
	}
}



Need to check this line skin_count%=3;
??is returning 1-3 or 0-2?????
EDIT - Yes error in code ... New code below
EDIT2 - Code notes - vSpeed should == 0 if no key input so like
vSpeed = nX*(key_w-key_s);
Code:
action my_action()
{
	set(my,SHADOW|CAST);
	var dist_to_move=0;
	var skin_count=0;
	var vSpeed=2;
	int flip_rate=18;
	while(1)
	{
		
		dist_to_move=(vSpeed*flip_rate)*time_step;
		skin_count+=(vSpeed*time_step)/dist_to_move;
		skin_count%=4;
		c_move(my,vector(vSpeed*time_step,0,0),nullvector,GLIDE);
		my.skin=clamp(integer(skin_count),1,3);//integer(skin_count);
		DEBUG_VAR(my.skin,50);
		wait(1);
	}
}



AS Always QnD code could be better..

Last edited by Malice; 06/21/16 18:52.