Godot Version
Godot 4.6
Question
Hello! I am new to coding, I’ve followed a tutorial on how to make my top-down movement, but it gave no information on how to animate my sprite, this has the controls for up down left and right, how would I animate this script?
extends CharacterBody2D
const SPEED = 300.0
const ACCEL = 2.0var input: Vector2
func get_input():
input.x = Input.get_action_strength(“right”) - Input.get_action_strength(“left”)
input.y = Input.get_action_strength(“down”) - Input.get_action_strength(“up”)
return input.normalized()func _process(delta):
var playerinput = get_input()velocity = lerp(velocity, playerinput * SPEED, delta * ACCEL)
move_and_slide()