1.1/Add trap
This commit is contained in:
@@ -3,7 +3,7 @@ extends CharacterBody3D
|
||||
|
||||
const SPEED:= 300.0
|
||||
const JUMP_VELOCITY:= 10.0
|
||||
|
||||
var Executed = false
|
||||
|
||||
@onready var animator = get_node("gobot_new/AnimationPlayer")
|
||||
@onready var hud_container: HBoxContainer = $hud/Hud_container
|
||||
@@ -29,10 +29,7 @@ var is_dead := false
|
||||
|
||||
|
||||
|
||||
func verfy_life():
|
||||
if health == 0:
|
||||
is_dead = true
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -122,6 +119,15 @@ func collect_coin():
|
||||
coins += 1
|
||||
hud_container.update_coin(coins)
|
||||
|
||||
func damage_player(amount: int):
|
||||
health -= amount
|
||||
verfy_life()
|
||||
func damage(amount: int):
|
||||
if not Executed:
|
||||
health -= amount
|
||||
verify_life()
|
||||
Executed = true
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
Executed = false
|
||||
|
||||
func verify_life():
|
||||
if health == 0:
|
||||
is_dead = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user