Programming player script

Godot Version

Godot engine 4.3

Question

when moving, rotation does not work, and the player cannot turn around, the code seems to be correct, what should I do?

But is it?

Please post your code (as pre-formatted text. i.e press the little </> icon in the post window and use that to post your code.)

func _process(delta):
# input
var direction = Input.get_vector(“left”, “right”, “up”, “down”)
velocity = direction * speed
rotation = direction.angle()
move_and_slide()

Note: I have defined left, right, up, and down in Project → Input Map
to work with WSAD keys, arrow keys, controller D pad, and controller left joystick.

Unless you map them yourself you would use ui_left, ui_right, and so on.