Discussion Forums at Tactical Neuronics


Moving into Line of Fire Logic From:
Jason Hect

I can't get my equation for determining if my bug is moving into an enemy's LOF to fit on one line. It works great if I split it between 2 lines but I guess is just too long for 1 line. I was wondering if anyone has code open to the public for accomplishing this in one line.

Here is a snipet of my current attempt. It shows the logic for when my bug is North of the enemy bug. The full equation basically does this for all 4 possibilities ( Enemy North, East, South, West).

CMath v1 = ( #y_pos < #enemy_y ) * ( #enemy_h = 1 ) * ( ( ( #cur_head = 2 ) And ( #x_pos < #enemy_x ) ) Or ( ( #cur_head = 4 ) And ( #x_pos > #enemy_x ) ) ) + Etc + Etc + Etc

So if I already know I'm one space off an enemy axis and then this equation returns a non-zero, then if I move forward I'm into an enemy's LOF.

Thanks for any suggestions!

Jason

Replies to this message:


© 2001, John A. Reder.