Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Xdif = Anaglyph.mouseX - playerX-25;
- Ydif = Anaglyph.mouseY - playerY-25;
- angle = Math.atan2(Ydif, Xdif) * 180 / Math.PI;
- dX = Math.cos(angle * Math.PI/180) * 10;
- dY = Math.sin(angle * Math.PI/180) * 10;
- playerX = ((playerX-mouseX)*(playerX+dX-mouseX) > 0 && playerX != mouseX) ? playerX+dX : mouseX;
- playerY = ((playerY-mouseY)*(playerY+dY-mouseY) > 0 && playerY != mouseY) ? playerY+dY : mouseY;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement