I'm trying to create a hit detection with c_trace. The idea is, that I want to look for a enemy standing in front or behind me. I can't find my mistake in the code, because everytime I use it, my c_trace calls a hit, even if I stay far away. Here is my code:

Code:
action enemy_with_pointer()
{
	enemy = my;
	c_updatehull(my, 1);
}

-------------------------------------

action guard_with_pointer()
{ 
	guard1 = my;	
	c_updatehull(my, 1);	
	while (1)
	{
		while (key_t == OFF) {wait (1);} 
		while (key_t == ON) {wait (1);}
		c_trace (guard1.x, enemy.x, IGNORE_ME + USE_BOX); // trace to the enemy
		if (you == enemy) // got the enemy?
		{
			guard_life -= 10;
		}
		else
		{
			guard_life += 10;
		}	
		wait (1);
	}
}



Last edited by h34dl4g; 05/31/10 19:49.

1338, beyond leet.