LOL - I'm bored!!

Best and last version but still QnD code
Code changes - removed clamp -- caused 1 to play double
-added back the %=3 modulo -- http://www.conitec.net/beta/avar-Ref.htm
- corrected the skin== 0 by adding +1 to my.skin = int(xN)+1;

Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////
action my_action()
{
	set(my,SHADOW|CAST);
	var dist_to_move=0;
	var skin_count=0;
	var vSpeed=2;
	int flip_rate=30;
	while(1)
	{
		vSpeed=2*(key_w-key_s);
		dist_to_move=(vSpeed*flip_rate)*time_step;
		if(dist_to_move)
		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)+1;//clamp(integer(skin_count),1,3);
		DEBUG_VAR(my.skin,50);
		wait(1);
	}
}
function main()
{
	vec_set(screen_size,vector(800,400,0));
	vec_set(screen_color,vector(50,1,1)); // dark blue
	vec_set(sky_color,vector(50,1,1)); // dark blue
	video_window(NULL,NULL,0,"My New Game");
	d3d_antialias = 1;
	shadow_stencil = 3;
	fps_max=60;
	level_load("tTest.wmb");
	vec_set(camera.x,vector(-250,0,50));
	vec_set(camera.pan,vector(0,-15,0));

}



Known issues - skin always flips in a cycle 1-3, can not reverse 3-1.
probable cause - skin_count%=3;

Last edited by Malice; 06/21/16 19:13.