1.1/Add trap
This commit is contained in:
+10
-8
@@ -17,12 +17,7 @@ var EXECUTED:= false
|
||||
@export var LIFE:= 2
|
||||
|
||||
|
||||
func verfy_life():
|
||||
if LIFE == 0:
|
||||
dead = true
|
||||
$head/Collision_head.set_deferred("disabled", true)
|
||||
state_machine.travel("poweroff")
|
||||
await animation_tree.animation_finished
|
||||
|
||||
|
||||
func _process(delta: float):
|
||||
if not dead:
|
||||
@@ -60,7 +55,7 @@ func attack_player():
|
||||
|
||||
func _on_area_3d_body_entered(body: Node3D) -> void: #head
|
||||
if body.name == "player":
|
||||
body.damage_player(DAMAGE_ATTACK)
|
||||
body.damage(DAMAGE_ATTACK)
|
||||
EXECUTED = true
|
||||
await get_tree().create_timer(2.0).timeout
|
||||
EXECUTED = false
|
||||
@@ -81,4 +76,11 @@ func _on_secondary_action_timer_timeout() -> void:
|
||||
func _on_damage_box_body_entered(body: Node3D) -> void:
|
||||
if body.name == "player":
|
||||
LIFE -= 1
|
||||
verfy_life()
|
||||
verify_life()
|
||||
|
||||
func verify_life():
|
||||
if LIFE == 0:
|
||||
dead = true
|
||||
$head/Collision_head.set_deferred("disabled", true)
|
||||
state_machine.travel("poweroff")
|
||||
await animation_tree.animation_finished
|
||||
|
||||
Reference in New Issue
Block a user