Help with lerp to rotation

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Icewheel12

So I got a lot of the code finished but now when I try to lerp across the 0/360 degree mark the object just rotates across the longest route. Here’s the code, is there any way someone could explain how to fix this like a child since that’s about the extent of my coding knowledge. Thanks, everyone.

extends Sprite

func _process(delta):

var deadZone = .3

var RedShieldSpeed = 10

var rx = Input.get_joy_axis(0, JOY_AXIS_0)
var ry = Input.get_joy_axis(0, JOY_AXIS_1)

var rotate = rad2deg(atan2(rx,ry))

if (abs(rx) > deadZone) or (abs(ry) > deadZone):
	self.rotation_degrees = lerp((self.rotation_degrees),(-rotate + 180), .5 * (delta * RedShieldSpeed))