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
+15
View File
@@ -0,0 +1,15 @@
extends MeshInstance3D
@export var damage_trap := 1
var Execute:= false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func _on_area_3d_body_entered(body: Node3D) -> void:
while Execute ==false:
body.damage(damage_trap)
Execute = true
await get_tree().create_timer(1.0).timeout
Execute = false
+1
View File
@@ -0,0 +1 @@
uid://cyf2dpymwq3qh
+16
View File
@@ -0,0 +1,16 @@
extends MeshInstance3D
var dead:= false
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_area_3d_body_entered(body: Node3D) -> void:
print(body.name)
+1
View File
@@ -0,0 +1 @@
uid://by3rc8i42d8iu