Verse Library verse

01 Device

Pauses device execution without blocking the main game loop.

verse-library/verse-concurrency-async-race-state-machines/01-device.verse

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

clock_device := class(creative_device):

    # OnBegin is <suspends> — it is allowed to wait
    OnBegin<override>()<suspends> : void =
        Print("Tick")
        Sleep(1.0)        # pause THIS function for 1 second; game keeps running
        Print("Tock")

Comments

    Sign in to vote, comment, or suggest an edit. Sign in