I'm drawing a laser fired from a ship like this:
Code:
//endPoint = ending X value of line(right edge of stage)
//shipX & shipY = laser start coordinates(starts from ship location)
this.graphics.lineStyle(1, 0X0000FF);
this.graphics.moveTo(shipX, shipY);
this.graphics.lineTo(endPoint, shipY);
It fires from left to right.
I also have moving targets on my stage that move from right to left.
Is there any property or method I could use to check the X & Y coordinates of my laser(line) to see if its "hit" a target?
Somehow, I need to get the X value of the laser, and see if it equals the first X value of the target that it encounters. If they equal, then I have a "hit".
Any thoughts or ideas on how to best accomplish this?
Thanks!