Noah Copeland
Member
Hello!
I'm trying to figure out a way to find the nearest enemy (obj_enemy), but only in the direction you are facing. (This is a 2D sidescroller for context).
If you are facing right, all the enemies to the left of you may as well not exist. The code only needs to find the nearest instance that also exists to the right, even if the enemy is above or below you vertically. (And vice-versa for the left).
I've searched the forums, but a lot of the solutions are for 360 games.
Any ideas?
I'm trying to figure out a way to find the nearest enemy (obj_enemy), but only in the direction you are facing. (This is a 2D sidescroller for context).
If you are facing right, all the enemies to the left of you may as well not exist. The code only needs to find the nearest instance that also exists to the right, even if the enemy is above or below you vertically. (And vice-versa for the left).
I've searched the forums, but a lot of the solutions are for 360 games.
Any ideas?