Files
DailyDungeon/Scripts/player_on_floor.gd

20 lines
604 B
GDScript

extends PlayerState
class_name PlayerOnFloor
func Physics_Update(delta):
dodge_roll()
standard_movement(delta)
body_look_at_mouse()
apply_gravity(delta)
respawn_on_fall(delta)
func dodge_roll():
if character.is_on_floor():
if character.stamina > character.DODGE_STAMINA_COST:
if Input.is_action_just_pressed("dodge"):
var dodge_direction = Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
if dodge_direction:
character.stamina -= character.DODGE_STAMINA_COST
character.dodge_direction = dodge_direction
Transitioned.emit(self,"dodge roll")