Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:
Ambiera Forum > CopperCube > Announcements and Showcase
behavior_doubleJump - Version 2
Author Text

Registered User
2018-12-20 02:22:33

I improved my double jump plugin a bit before I decided to work on behavior_enhancedFPSCamera. These final changes have a few new things like the check of the camera's additive relative height (set from extension variable), a setting to decide if to do a collision action on scene/script startup, a new variable for allowing infinite jumps, and some extension variable name changes.


This is a CopperCube behavior which makes an object jump (with the ability to double jump) when
space is pressed. Note that this behavior doesn't include movement scripts like moving with W,
A, S, and D. Be sure to set jump speed to 0 for the scene node you're attaching this behavior
to. The collision is checked by drawing a line from the scene node to an offset Y position below
the scene node. The Y offset is the length of the line. The line extrudes to below the camera.
Be sure not to input negative values as it will cause the line to extrude upwards instead,
causing unwanted affects. The "HeightOfNode" and "AdditiveRelativeHieght" values can be found in
the "Collide when moved" that you attached to the scene node that this behavior is attached to.
This behavior only works with physics simulation enabled, which only the Windows and Mac targets
support. To reset the values of all global variables in this behavior, call "behavior_doubleJump
_resetValues();" within the "Execute JavaScript" action. This is useful if you want to reset the
checking for when the very first collision has happened.

Behavior properties:

The scene node that this behavior is attached to.
The length of the collision line.
Additive to the length of the collision line. This should be "0" unless "RelativePosition"
property in the "Collide when moved" behavior has a Y value greater than 0.0.
The velocity (height) of the first jump.
The velocity (height) of the second jump.
The action that happens when the first jump happens.
The action that happens when the second jump happens.
Decides if the collision action should not happen when the very first collision happens.
The action that happens when collision of the line and the ground happens.

CopperCube variables that this script checks for (be sure to set these at scene startup):

if equals 1, disable jumping. Useful if you dont want to allow the player to jump during
cutscenes and such.
if equals 1, disallow a second jump. Useful for double jump to be an unlockable or not to be
allowed at all.
if equals 1, allow infinite jumps. Useful for debugging your game.

Functions that this behavior has that can be executed by the "Execute Javascript" action:

Reset the values of all the global variables within this behavior. Useful for reseting the check
for the very first collision.


Niko, you haven't put my behavior on the behaviors page yet despite asking if you could put that there. Since you asked, Ill say yes, again. Put this one there instead, as well.

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Internation?l" (you are not logged in)




Forum Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]