I am working on a project with another person in Godot, and they programmd the Player movemment. However, they programmed it using the Arrow keys for movement, and I preferd if it was on WASD, but they don’t know how to change it
My current movemment code:
unc player_movement(delta):
if Input.is_action_pressed("ui_right"):
current_dir = "right"
lastdir = Vector2.RIGHT
play_anim(1)
velocity.x = speed
velocity.y = 0
elif Input.is_action_pressed("ui_left"):
current_dir = "left"
lastdir = Vector2.LEFT
play_anim(1)
velocity.x = -speed
velocity.y = 0
elif Input.is_action_pressed("ui_down"):
current_dir = "down"
lastdir = Vector2.DOWN
play_anim(1)
velocity.y = speed
velocity.x = 0
elif Input.is_action_pressed("ui_up"):
current_dir = "up"
lastdir = Vector2.UP
play_anim(1)
velocity.y = -speed
velocity.x = 0
else:
play_anim(0)
velocity.x = 0
velocity.y = 0
move_and_slide()