extends CharacterBody2D const SPEED: int = 500 @onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D func _physics_process(delta: float) -> void: velocity = Input.get_vector("move_left","move_right","move_up","move_down").normalized() * delta * SPEED * 3 move_and_slide() animated_sprite.flip_h = velocity.x < 0 if velocity.length() != 0: animated_sprite.play() if velocity.x != 0: animated_sprite.animation = "side" else: if velocity.y < 0: animated_sprite.animation = "up" else: animated_sprite.animation = "down" else: animated_sprite.stop()