This commit is contained in:
RudyIm committed 2025-10-06 16:01:50 -04:00
1 parent afe089fdcd
commit ccdc54f587
3 files changed
+33 -13

No files matched your search

+24 -10
View File
@@ -1,21 +1,35 @@
extends Node2D
var totalCrates = 2 #This will be updated in the future, see SceneManager
var cratesDestroyed = 0
var timeLimit = 10
var timer:= Timer.new()
# 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 _ready():
add_child(timer)
timer.wait_time = 1
timer.one_shot = false
timer.connect("timeout", secondCounter)
timer.start()
$TimerLabel.text = str(timeLimit)
func secondCounter():
timeLimit -= 1
$TimerLabel.text = str(timeLimit)
if timeLimit <=0:
print("You lose baby!")
get_tree().reload_current_scene()
func _on_trigger_fired(intent: Variant, body) -> void:
print("GC knows trigger fired " +intent)
#print("GC knows trigger fired " +intent)
match intent:
"destroy":
print("destroy this thing")
body.queue_free()
if body.name.begins_with("Crate"):
cratesDestroyed +=1
body.queue_free() # destroy the crate - again will move to SceneManager
if cratesDestroyed>=totalCrates:
print("You win baby!")
get_tree().reload_current_scene()
"powerup":
print("power up this thing")
+1 -1
View File
@@ -11,5 +11,5 @@ func _process(delta):
pass
func _on_body_entered(body):
print("trigger fired")
#print("trigger fired")
triggerFiredSignal.emit(intent, body)