// This is a comment. The game ignores it. It's just for us.
// 1. DEFINE THE GAME STATE (Variables)
// Think of these like your inventory slots.
// 'IsGameActive' is a boolean (True/False) that tracks if the match is running.
var IsGameActive := true
// 2. DEFINE THE ENTITIES (The Scene Graph)
// We need to link our Verse script to the devices in the world.
// 'MyBallSpawner' is the name of the Ball Spawner device in the Event Browser.
// We use 'ref' to say "I am pointing to this specific device."
ref MyBallSpawner := "BallSpawner_1"
// 'RedZone' is the Capture Area for Team Red.
ref RedZone := "CaptureArea_Red"
// 3. THE MAIN LOGIC (The Game Loop)
// This function runs every frame (60 times a second).
// It checks if the game is active. If not, it does nothing.
OnBegin<override>()<suspends> async fun void() {
// While the game is still active...
while (IsGameActive) {
// Wait for the Ball Spawner to spawn a ball.
// 'OnSpawned' is an event that fires when the spawner creates a ball.
await MyBallSpawner.OnSpawned
// Once the ball is spawned, we need to watch it.
// But Verse is smart: we don't need to write a loop for every ball.
// We can just listen for the ball hitting the capture area.
Verse Library
verse
01 Fragment
Initializes game state and waits for ball spawner events to start a dodgeball round.
verse-library/ball-spawner-device-design-examples-in-fortnite-creative/01-fragment.verse
Sign in free to read the full source 🌴
This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.