# This is our main device. It lives in the world.
race_start_device := class(creative_device):
# This function starts when the game begins.
@init
constructor():
# We use 'spawn' to start the countdown in the background.
# The main code can keep going!
spawn countdown_timer()
# This is our background helper.
# It runs separately from the main game loop.
countdown_timer := function():
# We use a loop to count down.
for time := 3: time > 0: time -= 1:
# 'wait' pauses this specific function for one second.
wait(1.0)
# When the loop finishes, play the sound!
# (In real life, you'd trigger your sound device here)
print("GO!")
Verse Library
verse
01 Device
Runs a non-blocking countdown timer in the background while the main device continues.
verse-library/verse-concurrency-spawn-sync-race-and-loop-for-game-timing/01-device.verse