Rotation With Mouse Formulas


/ Published in: ActionScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. dx = mouseX - sprite.x;
  2. dy = mouseY - sprite.y;
  3. sprite.rotation = Math.atan2(dy, dx) * 180 / Math.PI;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.