I wrote this function (as show below) to use in pointing the enemies in my Geometry Wars-like game toward the player. Unfortunately, I can find no errors in the code that would cause it to return -1.#IND0000 no matter what the points entered.
Can anyone spot my error?
Function Rotate#(x0,y0,x1,y1) Local lega#,legb#,hypc# Local ang#,CosA# lega=Abs(x0-x1);legb=Abs(y0-y1) 'Get legs hypc=Sqr(lega^2+legb^2) 'Get hypotenuse CosA=hypc/legb 'Get cosine of angle ang=ASin(CosA) 'Get degrees in angle Return ang End Function
Can anyone spot my error?