Pointing one sprite in the direction of another
BlitzMax Forums/BlitzMax Programming/Pointing one sprite in the direction of another
| ||
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? |
| ||
If the y coordinates are ever the same, you're going to run into a divide by zero operation. Not sure if that's your problem or not though. |
| ||
Yea, good point. I'd probably get a nasty headache later on if I hadn't figured that out now. Thanks for that. [edit] just realized that I had ASin where I should have had ACos, but changing this had no affect on the returned value. [edit 2] I found the problem. Dummie me put leg/hypotenuse rather than hypotenuse/leg -.- |