Verse Library verse

01 Fragment

Device component that hides and reveals a prop after a brief delay.

verse-library/hiding-and-showing-the-platform/01-fragment.verse

# This line defines our custom device.
# 'Device' is the base class for all interactive Verse scripts.
# We are creating a new blueprint called 'VanishingPlatformDevice'.
VanishingPlatformDevice: device =
    # This is our 'Component' that links to the actual prop in the editor.
    # We assign it to a variable named 'DisappearingPlatform'.
    # The type 'creative_prop' tells Verse this object is a prop we can manipulate.
    DisappearingPlatform: creative_prop = component()

    # This is the 'Event' that triggers when the game starts.
    # 'OnBegin' is a special event built into the Device class.
    # '<override>' means we are defining how THIS specific device handles that event.
    # '<suspends>' allows our code to pause (wait) without freezing the whole game.
    OnBegin<override>()<suspends>: void =
        # STEP 1: Hide the platform.
        # We call the 'Hide()' method on our DisappearingPlatform object.
        # It's like pressing the 'Invisible' button on the remote.
        DisappearingPlatform.Hide()

        # STEP 2: Wait.
        # If we don't wait, the platform will hide and show instantly.
        # Humans can't see that happen. It just looks like it was always there.
        # 'Wait()' pauses this specific script for 0.5 seconds.
        Wait(0.5)

        # STEP 3: Show the platform.
        # We call the 'Show()' method to make it visible again.
        # Now the player sees the platform appear out of thin air!
        DisappearingPlatform.Show()

Comments

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