class_name GameController extends Node2D @export var timeLimit = 10 var timer = Timer.new() var elapsedSeconds = 0 # Called when the node enters the scene tree for the first time. func _ready() -> void: add_child(timer) timer.wait_time = 1 timer.one_shot = false timer.connect("timeout", secondPassed) timer.start() # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass func _on_area_2d_trigger_fired(effect: Variant, body: Variant) -> void: print("trigger signal received") #if body is CharacterBody2D: #pass if body is RigidBody2D || body is CharacterBody2D: #body.position = Vector2(400,0) #body.velocity = Vector2(0,0) body.position = Vector2(576,0) func secondPassed(): elapsedSeconds += 1 print("%d seconds have passed" % elapsedSeconds) if elapsedSeconds >= timeLimit: print("GAME OVER LOSER")