How do I stop it from skipping the last 7 frames of the rotation

Godot Version

Godot v4.4.1.stable

Question

I’m trying to get the player character’s sprite to change to give the illusion of rotating. I made 22 frames and had a slight idea of what I needed to do, but for some reason it stops working for the last 7 frames. I am really inexperienced with godot and coding as a whole, so I don’t know what is causing the issue.
The code:
#Runs every Frame
func _process(delta):
##Gets the mouse position
var mouseX = get_global_mouse_position().x
var mouseY = get_global_mouse_position().y
##Gives the angle from the player to the mouse
var playerDirection = (atan2(mouseY-position.y,mouseX-position.x)*100)
#Prints the angle that the mouse is to the player for debugging
print(playerDirection)
##Sets the frame to be whatever the opposite of the angle is divided by the number of frames and rounds it
frame = -round(playerDirection/22)

Why do you multiply by 100? atan2 returns radians, from 0 to TAU

Maybe you want to use this equation?

var difference: Vector2 = get_global_mouse_position() - global_position
var direction: float = difference.angle() # uses atan2 to find angle of a Vector2
# floori may be closer to the correct frame, never overshooting to 23
# divide by TAU to get 0.0 to 1.0, then multiply for 0 to 22
# an angle of 0 is facing right
var frame: int = floori(direction / TAU * 22)