Godot Version
Godot v4.2.2
Question
I’m trying to make my object rotate to the sides, but it isn’t working. It should sway to the right, hit 30degrees and go to 330degrees to the left and then repeat.
Does anyone have an idea as to why this isn’t working? Thanks in advance!
extends CharacterBody2D
var switch = false
# Called when the node enters the scene tree for the first time.
func _physics_process(_delta):
if rotation_degrees == 30:
switch == true
if rotation_degrees == 330:
switch == false
if rotation_degrees == 0:
rotation_degrees += 0.5
if rotation_degrees > 30 && switch == false:
rotation_degrees -= 0.5
if rotation_degrees <330 && switch == true:
rotation_degrees += 0.5