37 lines
988 B
GDScript
37 lines
988 B
GDScript
extends State
|
|
class_name PlayerRun
|
|
|
|
func get_state_name():
|
|
return str(self).split(":")[0]
|
|
|
|
func enter():
|
|
player.air_jumps_done = 0
|
|
player.jumps_done = 0
|
|
player.coyote_timer = 0.0
|
|
player.wallrun_available = true
|
|
player.dash_available = true
|
|
player.v_mult = 1
|
|
func exit():
|
|
pass
|
|
func update(delta):
|
|
player.ap.play("run")
|
|
|
|
if player.transitionidle():
|
|
Transitioned.emit(self, "PlayerIdle")
|
|
elif player.transitionroll():
|
|
Transitioned.emit(self, "PlayerRoll")
|
|
elif player.transitioncrouch():
|
|
Transitioned.emit(self, "PlayerCrouchwalk")
|
|
elif player.transitionwallrun():
|
|
Transitioned.emit(self, "PlayerWallrun")
|
|
elif Input.is_action_just_pressed("jump") and player.can_vault and player.is_facing_vault_direction():
|
|
Transitioned.emit(self, "PlayerVault")
|
|
Transitioned.emit(self, "PlayerVault")
|
|
elif player.transitionjump():
|
|
Transitioned.emit(self, "PlayerJump")
|
|
elif player.transitionfall():
|
|
Transitioned.emit(self, "PlayerFall")
|
|
|
|
func physics_update(delta):
|
|
pass
|