// 1. The Script Header // This tells the game: "I am a script that runs when the game starts." script class VerticalVictoryScript: IScript { // 2. Components (The "What") // These are references to devices you place in the level. // Think of these as "slots" where you plug in your real devices. button_device: ButtonDevice = Self.GetActor() timer_device: TimerDevice = Self.GetActor() // 3. Constants (The "Rules") // These values never change. Like the max health in a standard match. const WIN_TIME := 60.0 // 60 seconds to win // 4. Variables (The "State") // These change during the game. Like your shield level. game_active: bool = false // 5. Events (The "Triggers") // This runs once when the island loads. OnBegin() { // Start the timer immediately timer_device.StartTimer(WIN_TIME) // Mark the game as active game_active = true // Wait for the timer to finish OR the button to be pressed WaitForGameEnd() } // This event runs every time the button is pressed OnButtonPressed(pressed: bool) { if (pressed and game_active) { // Player hit the button! timer_device.StopTimer() game_active = false // Tell everyone they won Print("Winner Winner, Truck Dinner!") // End the game with a win state EndGame(1, 0) // 1 win, 0 losses } } // This event runs when the timer hits zero OnTimerFinished() { if (game_active) { // Time's up! game_active = false Print("Time's Up! You're Toast.") // End the game with a loss state EndGame(0, 1) // 0 wins, 1 loss } } }