Rotate to point towards mouse

I am making somewhat a diep.io wick port with fake multiplayer but i’m not very much of a javascript coder, but is it possible to make rotation of an object point towards your cursor? i do believe i need to do some math to accomplish this.

Welcome to the forums.

To accomplish something like this before I have used the following code

let dx = (playerClip.x - mouseX);
let dy = (playerClip.y - mouseY);
        
if (dx > 0) {
    playerClip.rotation = (Math.atan(dy/dx)*180/Math.PI)-90;
} else {
    playerClip.rotation = (Math.atan(dy/dx)*180/Math.PI)+90;
}

You can replace playerClip with the name of the clip that you want to point towards the mouse.

It just gets the distance between the character and mouse and puts that into an atan function to find the angle to point to.

this is helpful!