Verse Library verse

01 Standalone

Defines a jump pad device that launches players upward when they interact with it.

verse-library/playtesting/01-standalone.verse

# This is a simple script for a Jump Pad
# It makes the pad launch players when they touch it

Jump_Pad = struct:
    # This is a device we place in the world
    # It is like a box that holds our code
    device: Device

    # This function runs when the game starts
    On_Begin_Play := func():
        # We tell the device to listen for touches
        device.On_Interact += func(interaction: Interaction):
            # If a player touches the pad...
            if (interaction.Actor.Is_Player()):
                # ...we launch them into the air!
                # We don't need complex math here.
                # The device handles the physics.
                device.Apply_Launch_Force(1000.0)

Comments

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