Shoot to mouse (vectorToAngle) issue

In my project, I have it set so that a projectile is spawned on mouse click and it's velocity is changed to:
vectorToAngle(mouse.posX - actor.posX, mouse.posY - actor.posY)
so that my projectiles are always fired to the mouse location.

The issue is when I move to a particular part of the scene. Suddenly, the mouse-to-actor angles start to mess up. They work fine when the actor is near the beginning of the scene, but the angles become wild as I move through the scene.

I have attached my project so that you can take a look. Frank is the main actor, Projectile is the bullet, each are constrained to Game variables. WASD to move and mouse to shoot.

http://www.mediafire.com/download.php?e4jiasougjvalkd (Mac)

http://www.mediafire.com/download.php?jctxycwpjqmn8g0 (PC)

Best Answer

Answers

Sign In or Register to comment.