Verse Library verse

01 Fragment

Detects player overlap and applies upward velocity to launch them into the air.

verse-library/tire-bouncer-options/01-fragment.verse

# This is our main script. It defines the behavior of our Chaos Launcher.
# In Verse, we often use a "Device" structure to hold our logic.
struct ChaosLauncher: Device:
    # --- CONSTANTS ---
    # A constant is like the 'Damage Type' of your weapon. 
    # It is set once and never changes. 
    # Here, we define the unit of measurement for velocity.
    const METERS_PER_SECOND := "meters/second"

    # --- VARIABLES ---
    # A variable is like your 'Current Ammo Count'. 
    # It can change. We use [Public] so you can tweak it in the UEFN 
    # properties panel without touching the code.
    # Default is 20 m/s (a standard, safe bounce).
    [Public] BounceStrength: float = 20.0

    # This event triggers when a player interacts with the device.
    # Think of this like the 'Trigger' on a trap. 
    # 'Other' is the player who hit the bouncer.
    event OnBeginOverlap(Other: Actor):
        # Check if the thing that hit us is actually a Player.
        # (You don't want to bounce a crate into the sun... usually.)
        if (Player := Other as Player):
            # Apply the force!
            # We take the Player's current velocity and add our BounceStrength.
            # The 'Up' vector means we launch them straight up.
            Player.ApplyVelocity(BounceStrength * Vector_Up)

    # This is a helper to make sure the script knows what 'Vector_Up' is.
    # It’s like saying 'North' on a compass.

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