Verse Library verse

01 Fragment

Links level props to a script and toggles visibility on start to verify device communication during island initialization.

verse-library/3-setting-up-the-level/01-fragment.verse

# This line tells Verse that this script belongs to the VerseDevice in our level.
# Think of it like saying "This script controls the device named 'VerseDevice'."
struct MyLevelScript : VerseDeviceScript {
    # We need to tell Verse where to find our objects.
    # We do this by creating "references" to the props in our level.
    # 'SpawnPad' and 'TestPlatform' must match the Names we set in the editor!
    SpawnPad: PlayerSpawnPad = Self.GetReference(PlayerSpawnPad, "SpawnPad")
    TestPlatform: CreativeProp = Self.GetReference(CreativeProp, "TestPlatform")

    # This function runs ONCE when the game starts.
    # It’s like the "Countdown" before the match begins.
    OnBegin<override>()<test> = () => {
        # Let’s do something visible immediately.
        # We’ll hide the platform for 1 second, then show it.
        # This proves Verse is talking to our props.
        
        # 1. Hide the platform instantly.
        # Hide() makes the prop invisible AND removes its collision (you can walk through it).
        TestPlatform.Hide()
        
        # 2. Wait 1 second.
        # This is like a storm timer delay.
        @Wait(1.0)
        
        # 3. Show the platform again.
        # Show() makes it visible and puts the collision back.
        TestPlatform.Show()
        
        # Optional: Print a message to the debug log so we know it worked.
        # It’s like checking your kill feed to see if you got an elimination.

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