16 lines
365 B
GDScript
16 lines
365 B
GDScript
extends CharacterBody2D
|
|
|
|
const SPEED = 600
|
|
|
|
@onready var happy_boo = $HappyBoo
|
|
|
|
func _physics_process(_delta: float) -> void:
|
|
var direction = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
|
velocity = direction * SPEED
|
|
move_and_slide()
|
|
|
|
if velocity.length() > 0.0:
|
|
happy_boo.play_walk_animation()
|
|
else:
|
|
happy_boo.play_idle_animation()
|