<aside> ⚡ script "map_bouncepad_horizontal" (int force, int angle, int sound)

</aside>

Event


This script is called by the player whenever they step on a horizontal bounce pad. The parameters are determined by the bounce pad on which they stepped on.

Usage


This script can replaced by adding a new script in your map of the name, map_bouncepad_horizontal, to add additional behavior to this event, or override the existing behavior.

This script has no expected return value.

Parameters

Default Script


The default horizontal bounce pad script has relatively universal behavior.

First, to prevent the player from getting unintended extra bounce, check for a short-lived powerup called "JumpDirDelay". This powerup lasts 8 tics. If the player has this powerup, stop the script. Otherwise, give it to them.

Apply the given force in the direction corresponding to angle.

Using sound as an index into an array, play a sound effect for the bounce sound.

// Activator: Player who bounced
//
str padSounds[3] = {
    "misc/boing",
    "misc/jumppad",
    "misc/pumpjet",
};

script "map_bouncepad_horizontal" (int force, int angle, int sound)
{
    if(CheckInventory("JumpDirDelay") > 0)
        terminate;
    GiveInventory("JumpDirDelay", 1);
    if(sound > -1) {
        ThingSound(ActivatorTID(), padSounds[sound], 128);
    }
    ThrustThing(angle * 256 / 360, force, force>30, 0);
}

Example Replacement