B
BigCat
Guest
I'm building a top-down shooter.
I have a target-A which basically sits in the center of the room
I have ships which fly around the room in various formation patterns or whatever.
The ships have laserbeams that fire directly forward.
I want the ships, as they fly about the room - to check whether they are facing target-A - and if so - shoot their lasers.
I have everything figured out - EXCEPT - how to check if an instance is facing another instance.
I've tried: if direction = point_angle ( x, y, target.x, target.y )
I've tried: if image_angle = point_angle ( x, y, target.x, target.y )
But I'm missing something or using it wrong - I dunno. It runs fine and doesn't throw any errors that I can see. But it just doesn't pull the trigger when it's supposed to.
My best guess - was that the two values are really never the same because of the rotation of the enemy ships. They rotate at a specific rate per frame which likely makes the two sides of the equation basically impossible without a relative range in place.
SO - My next attempt was something like
IF direction - point_angle (x,y, target.x, target.y) <= 20
But nope... that didn't do diddly either.
So now i'm sad. *sigh*
Any ideas or insight would be great.
I'm using DND - but I'm not afraid to write complex expressions.
I have a target-A which basically sits in the center of the room
I have ships which fly around the room in various formation patterns or whatever.
The ships have laserbeams that fire directly forward.
I want the ships, as they fly about the room - to check whether they are facing target-A - and if so - shoot their lasers.
I have everything figured out - EXCEPT - how to check if an instance is facing another instance.
I've tried: if direction = point_angle ( x, y, target.x, target.y )
I've tried: if image_angle = point_angle ( x, y, target.x, target.y )
But I'm missing something or using it wrong - I dunno. It runs fine and doesn't throw any errors that I can see. But it just doesn't pull the trigger when it's supposed to.
My best guess - was that the two values are really never the same because of the rotation of the enemy ships. They rotate at a specific rate per frame which likely makes the two sides of the equation basically impossible without a relative range in place.
SO - My next attempt was something like
IF direction - point_angle (x,y, target.x, target.y) <= 20
But nope... that didn't do diddly either.
So now i'm sad. *sigh*
Any ideas or insight would be great.
I'm using DND - but I'm not afraid to write complex expressions.
Last edited by a moderator: