Verse Library verse

01 Fragment

Tracks player votes via triggers and updates the visual result in real time.

verse-library/low-stakes-formative/01-fragment.verse

# This is a comment. It's like leaving a note for yourself.
# The compiler (the game's brain) ignores these.

# We define a "Script" which is like a container for our logic.
# Think of it as the "Brain" of our voting system.
script VotingSystem: Script {

    # VARIABLES: These are our scoreboards.
    # They start at 0. They will change during the game.
    RedVotes: int = 0
    BlueVotes: int = 0

    # We need references to our objects in the world.
    # This is like pointing to your loadout items.
    # We will connect these in the Editor later.
    RedTrigger: Trigger = Trigger{}
    BlueTrigger: Trigger = Trigger{}
    ResultPillar: StaticMeshActor = StaticMeshActor{}

    # EVENT: This function runs automatically when a player touches the Red Trigger.
    # "OnBeginOverlap" is the event. It’s like the "Player Entered Zone" signal.
    OnBeginOverlap(RedTrigger: Trigger, Other: Actor): void = {
        # Increment (add 1) to the RedVotes variable.
        # It’s like getting an elimination. +1 to the count.
        RedVotes += 1

        # Update the visual result immediately.
        UpdateResult()
    }

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