(I think think you need more of my code than this to see the problem, but if you do, I'll post it)
My missile object has this method:
Here is the degrees function:
I use this to make the missile be shot against the mousepointer. And it appears to work. However, upon closer inspection I noticed that the aim is wrong. When shooting in any straight direction, such as North or West, the aim is perfect, by in between them the aim becomes wrongs. Is my aiming math in error?
My missile object has this method:
Method Fire(X:Float,Y:Float,Speed:Float) Local Angle:Float = DegreesBetweenPoints(XPos, YPos, X, Y) XSpeed = Sin(Angle) * Speed YSpeed = Cos(Angle) * Speed End Method
Here is the degrees function:
Function DegreesBetweenPoints:Float(X1:Float,Y1:Float,X2:Float,Y2:Float) Return 180.0 - ATan2(X2 - X1,-(Y2 - Y1)) End Function
I use this to make the missile be shot against the mousepointer. And it appears to work. However, upon closer inspection I noticed that the aim is wrong. When shooting in any straight direction, such as North or West, the aim is perfect, by in between them the aim becomes wrongs. Is my aiming math in error?