add dramatic tension

This commit is contained in:
KevinGorman committed 2025-01-06 20:51:49 -05:00
1 parent 2605a085e2
commit 90bdd35020
2 files changed
+24 -3

No files matched your search

+23 -2
View File
@@ -1,17 +1,38 @@
extends Node2D
var boxTotal = 4
var timer:= Timer.new()
@export var secondCount= 15
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
add_child(timer)
timer.wait_time = 1
timer.one_shot = false
timer.connect("timeout", secondCounter)
timer.start()
func secondCounter():
print("time left: ", secondCount)
secondCount -=1
if secondCount <= 0:
print("A loser is you")
get_tree().reload_current_scene()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_trigger(effect: Variant, body) -> void:
print("they were triggered!")
if body is RigidBody2D:
if body is RigidBody2D:
print("crate spotted")
boxTotal -= 1
body.queue_free()
if boxTotal <=0:
print("A winner is you")
get_tree().reload_current_scene()