babycarlitos Posted May 5, 2016 Share Posted May 5, 2016 Hello everyone, I have 2 questions and I think they both deal with math. 1. How do i get the x,y, x+ width and y+ height of a sprite after setting a rotation (corners of sprite) image 1 (white background image) 2. how do i make a sprite look at the position of the mouse ( rotate to where the mouse is) I tried various version and this seems to give me the closes one var angle = Math.atan2(mouseX - (boxIMG.position.x), -(mouseY - boxIMG.position.y)); then set the rotation to that boxIMG.rotation = angle; but is not working correctly (black background image) Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.