T
T. Brugel
Guest
Hey everyone!
I am currently making a tower-defense survival game.
But I have a minor problem.
I am working on new levels for the game, and the levels get more complicated along the campaign of the game.
So there is a level, with a wall.
And I want my shooting towers not to be focusing enemies on the other side of the wall, because of the fact that tthere is a wall in between.
Instead, the tower should focus on the nearest enemie in sight.
Right now I store the nearest enemie in a variable:
var obj = instance_nearest(x, y, obj_enemy);
And when it is about to shoot it checks if the distance to the nearest enemie is smaller than or equal to the range of the tower.
I have no idea how I can make it so the tower focuses the nearest enemie in sight.
I guess something with collision lines?
Thanks in advance!
Cheers
I am currently making a tower-defense survival game.
But I have a minor problem.
I am working on new levels for the game, and the levels get more complicated along the campaign of the game.
So there is a level, with a wall.
And I want my shooting towers not to be focusing enemies on the other side of the wall, because of the fact that tthere is a wall in between.
Instead, the tower should focus on the nearest enemie in sight.
Right now I store the nearest enemie in a variable:
var obj = instance_nearest(x, y, obj_enemy);
And when it is about to shoot it checks if the distance to the nearest enemie is smaller than or equal to the range of the tower.
I have no idea how I can make it so the tower focuses the nearest enemie in sight.
I guess something with collision lines?
Thanks in advance!
Cheers