# 1. Define the "Game State" (Variables) # A variable is like a scoreboard that changes. # Here, we track if the game is running. is_game_active := false # 2. The Main Game Loop / Initialization # This function runs once when the island loads. # It's like the "Start Game" button on the battle bus. OnStart := func() -> void: # Spawn the Big Rig at the start line # We tell the spawner device to create a "Big Rig" entity big_rig_spawner.Spawn() # Start the timer counting down from 60 seconds # This is your storm timer, but for the whole match timer.Start(60.0) # Update our scoreboard variable is_game_active = true # 3. The Victory Condition (Event Handling) # This code runs ONLY when the button is pressed. # It's like an elimination notification popping up. OnButtonPressed := func() -> void: if is_game_active: # Stop the clock! timer.Stop() # Calculate score based on time left # (Imagine this adding points to your XP bar) final_score = timer.GetRemainingTime() * 10 # Tell everyone they won print("RIG MASTER! Score: ", final_score) # End the round or reset is_game_active = false # 4. The "Game Over" Condition # This runs if the timer hits zero. OnTimerFinished := func() -> void: if is_game_active: print("TIME'S UP! You flipped.") # Maybe spawn a trap here? is_game_active = false