Verse Library verse

01 Device

Tracks a mutable integer score incremented by button interactions and displays it via HUD.

verse-library/build-your-own/01-device.verse

# This is a comment. Verse ignores lines starting with #.
# Think of it as a sticky note for yourself.

using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/Diagnostics }

# We create a "Script" which is the container for our logic.
# It's like creating a new folder for our island's brain.
score_script := class(creative_device):

    # DEVICE REFERENCES: Wire these up in the UEFN Details panel.
    # ChaosButton is a button_device placed on the map.
    @editable
    ChaosButton : button_device = button_device{}

    # ScoreDisplay is a hud_message_device used to show the score.
    @editable
    ScoreDisplay : hud_message_device = hud_message_device{}

    # VARIABLES: These are our "containers."
    # var score : int means "score" is a mutable box that holds whole numbers.
    # It starts at 0.
    var score : int = 0

    # OnBegin runs automatically when the game starts.
    # This is where we connect our events (plug in the wires).
    OnBegin<override>()<suspends> : void =

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.

Sign in with Discord

Comments

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