added ducking!
This commit is contained in:
parent
d59c37eb49
commit
9c6eb512d9
3 changed files with 84 additions and 4 deletions
|
@ -83,6 +83,10 @@ func _physics_process(delta: float) -> void:
|
|||
state_chart.send_event("jump")
|
||||
if Input.is_action_just_pressed("shoot"): # shooting
|
||||
state_chart.send_event("shoot")
|
||||
if Input.is_action_pressed("ui_down"):
|
||||
state_chart.send_event("duck_pressed")
|
||||
if Input.is_action_just_released("ui_down"):
|
||||
state_chart.send_event("duck_released")
|
||||
|
||||
# send relevant events
|
||||
if is_on_floor(): # check on floor status
|
||||
|
@ -141,6 +145,10 @@ func _on_Blinking_state_entered() -> void:
|
|||
func _on_Stimming_state_entered() -> void:
|
||||
animation_player.play("stim")
|
||||
|
||||
func _on_Ducking_state_entered():
|
||||
velocity.x = 0
|
||||
animation_player.play("duck")
|
||||
|
||||
func _on_Pushing_state_entered() -> void:
|
||||
animation_player.play("push")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue