shield!
This commit is contained in:
parent
1dc515904c
commit
2a1eda7cc0
10 changed files with 100 additions and 2 deletions
|
@ -47,6 +47,8 @@ var skip_blood: bool = false
|
|||
#whether sg has landed before
|
||||
var first_land = true
|
||||
|
||||
var can_shield = true
|
||||
|
||||
|
||||
# NODE REFERENCES #
|
||||
onready var state_chart: StateChart = $StateChart
|
||||
|
@ -116,6 +118,17 @@ func _physics_process(delta: float) -> void:
|
|||
state_chart.send_event("duck_pressed")
|
||||
if Input.is_action_just_released("move_down"):
|
||||
state_chart.send_event("duck_released")
|
||||
if Input.is_action_just_pressed("shield") && Game.can_use_shield == true:
|
||||
if can_shield:
|
||||
Audio.play_sound(Audio.a_shield,Audio.ac_die)
|
||||
$ShieldTimer.start()
|
||||
$ShieldCooldown.start()
|
||||
$Shield.visible = true
|
||||
$"%AirborneShape".disabled = true
|
||||
$"%GroundedShape".disabled = true
|
||||
can_shield = false
|
||||
|
||||
|
||||
|
||||
# send relevant events
|
||||
if is_on_floor(): # check on floor status
|
||||
|
@ -571,3 +584,14 @@ func make_blood():
|
|||
func _on_Zapping_state_exited():
|
||||
$Graphics/ZapSprite.visible = false
|
||||
emit_signal("died")
|
||||
|
||||
|
||||
func _on_ShieldTimer_timeout():
|
||||
$Shield.visible = false
|
||||
$"%AirborneShape".disabled = false
|
||||
$"%GroundedShape".disabled = false
|
||||
|
||||
|
||||
func _on_ShieldCooldown_timeout():
|
||||
can_shield = true
|
||||
Audio.play_sound(Audio.a_shield_cooldown,Audio.ac_boss)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue