Godot Version
4.2.2
Question
Help! I can’t get my character to move left. The code is the same compared to other directions.
`extends CharacterBody2D
@export var speed: int = 35
@onready var animations = $AnimationPlayer
func handleInput():
var moveDirection = Input.get_vector (“uileft”, “ui_right”, “ui_up”, “ui_down”)
velocity = moveDirection*speed
func updateAnimation():
if velocity.length() == 0:
animations.stop
var direction = “Down”
if velocity.x < 0: direction = “Left”
elif velocity.x > 0: direction = “Right”
elif velocity.y < 0: direction = “Up”
animations.play(“walk” + direction)
func _physics_process(delta):
handleInput ()
move_and_slide()
updateAnimation()
`