start of player char
This commit is contained in:
parent
2926a12796
commit
3c62183156
11 changed files with 335 additions and 5 deletions
25
objects/player/player.gd
Normal file
25
objects/player/player.gd
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue