Hi, I am working on a project in which I have an entity and every few frames it fires our another entity.
What I want this other entity to do is to move forward for 50 frames and then reverse direction.
here's the action that I am using:
Code:
action pulse()
{
	var dist_test = 0;
	var move_dir = 85;
	my.pan = you.direction;
	set(my, PASSABLE);
	while (my)
	{
		c_move (me, vector(move_dir*time_step, 0, 0), nullvector, IGNORE_PASSABLE);
		dist_test ++;
		if (dist_test == 50)
		{
			move_dir = -85;
			wait(-1);
		}
		wait(1);
	}
}



it does exactly what I want it to the first time
but every subsequent time it reverses direction much faster than the first.
I'm not 100% sure, but I think it's because the "dist_test" var is changes faster, but I have no idea why that would be happening.
I don't have any global variables that could be effecting them, so I don't know how they can act differently.
Thanks