[SHOOTING]Rotated towards a target

Hello, basicallly, is there a type of shooting to check if the gun is pointing at a target? Like, you get a target, you get the angle from the gun to the target…and, when the mouse is pressed, the gun will check to see if it is in the same angle as from the gun to the target.

I’m working on one of my games right now so I can’t create the code. I can explain what to do though. Find out how to rotate something towards a target. Put that into the game. And check if your angle is the same angle needed to hit the target:

if (currentRotateAngle == NeededTargetAngle)
{
Fireing = true;
//says that you can now fire the gun
}
if (Fireing == true)
{
Place all the shooting stuff into here
}

There you go… Back to work!!! :crazy: :mountie:

Ok. I’ll figure something out, and then I’ll post it on here. Thanks for helping!

Ok…I’ve figured out a script for if you shoot DIRECTLY at the (x,y) of the target. But what I want to do is make it so that if you just point in any general direction that you will hit the target, not just on its ordered pair. So maybe when I put in ordered pair differences, maybe I could make the ordered pair add and subtract some number(Say, it’s width, for example). This is hard…I need someone smart to help me out here, lol.