A
Antera
Guest
Hello,
So a projectile is created from the player and moves to the nearest enemy
When a bullet meets a wall, it is destroyed
I'd like to automatically target the nearest_enemy that the bullet can reach without being destroyed by a wall
How can do this check ?
Something like line_is_free_of_walls()
Many thanks for your help
So a projectile is created from the player and moves to the nearest enemy
When a bullet meets a wall, it is destroyed
I'd like to automatically target the nearest_enemy that the bullet can reach without being destroyed by a wall
Code:
nearest_enemy = instance_nearest(x,y,oEnemy);
// TODO : check if there is a wall between x y and the nearest_enemy
// else choose 2nd nearest_enemy etc.
direction = point_direction(x, y, nearest_enemy.x, nearest_enemy.y);
speed = 16;
image_angle = direction;
How can do this check ?
Something like line_is_free_of_walls()
Many thanks for your help