start of player char

This commit is contained in:
Haze Weathers 2025-11-01 19:58:18 -06:00
parent 2926a12796
commit 3c62183156
11 changed files with 335 additions and 5 deletions

25
objects/player/player.gd Normal file
View file

@ -0,0 +1,25 @@
class_name Player
extends CharacterBody2D
@export var walk_speed: float
@export_group("Internal References")
@export var _animations: AnimationPlayer
var is_stunned := false
func _physics_process(delta: float) -> void:
if is_stunned:
pass
else:
var input_dir = Input.get_vector(&"move_left", &"move_right", &"move_up", &"move_down")
velocity = input_dir * walk_speed
if input_dir.is_zero_approx():
_animations.play(&"idle")
else:
_animations.play(&"walk")
move_and_slide()