(Solved) Object rotating to the opposite of cursor position

Can someone help me? I don’t know why this is happening.

The red dot is where the cursor is.

Code:

Thanks

Do you want it to rotate in the opposite direction of the mouse position or not? From what I understand from the images is that you are not looking for that. In that case, you must evaluate both the origin and the center points of the rotating object. On the other hand, keep in mind that for the object to be drawn “front-on”, the image must be facing to the right. The right is zero degrees.

I want it to rotate to the cursor position.

I remade the gun sprite and it worked.