Verse Library verse

07 Device

Implements a Creative Device that subscribes to button clicks to start and track active rounds.

verse-library/verse-layout-and-structure/07-device.verse

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

round_manager := class(creative_device):

    @editable
    StartButton : button_device = button_device{}

    var RoundActive : logic = false

    OnBegin<override>() : void =
        StartButton.InteractedWithEvent.Subscribe(OnStartPressed)

    OnStartPressed(Agent : agent) : void =
        if (not RoundActive?):
            set RoundActive = true
            Print("Round started")

Comments

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