1.1/Add trap

This commit is contained in:
2026-05-28 08:51:08 -03:00
parent b8442324fa
commit b0ced7a793
37 changed files with 6522 additions and 40 deletions
+14 -8
View File
@@ -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