Verse Library verse

01 Fragment

Shows a welcome message on the HUD when a round starts, then optionally hides it.

verse-library/triad-inflitration-09-creating-visual-aids-in-verse/01-fragment.verse

# This is the main structure for our island logic.
# Think of it as the "Main Menu" of your code.
struct Main : WorldDevice {
    # 1. DECLARE THE DEVICE
    # We need to tell Verse which HUD Message device we are controlling.
    # This is like plugging a controller into the console.
    HudDevice : HUDMessageDevice = HUDMessageDevice{}

    # 2. DEFINE THE MESSAGE CONTENT
    # This is our "Variable." It holds the text string.
    # We define it here so we can change the text in one place if we want.
    MessageContent := "Welcome! Your objective is to survive."

    # 3. THE EVENT: Round Start
    # This function runs automatically when the round begins.
    # It’s the "Bus Drop" moment for your code.
    OnBegin<override>()<suspends>: void = {
        # 4. ASSIGN THE MESSAGE
        # We take our variable (MessageContent) and set it into the device.
        # It’s like loading the ammo into the gun before firing.
        HudDevice.SetMessage(MessageContent)

        # 5. TRIGGER THE DISPLAY
        # Now that the message is set, we tell the device to show it.
        # This is the "Fire" button.
        HudDevice.Show()
        
        # Optional: Hide it after a few seconds so it doesn't block gameplay forever.
        # Uncomment the next line if you want it to disappear after 5 seconds.
        # -> HideMessage()

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