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

xanimalkingx
Registered User
Quote
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.

Description:

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:

"SceneNodeName":
The scene node that this behavior is attached to.
"HeightOfNode":
The length of the collision line.
"AdditiveRelativeHieght":
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.
"FirstJumpVelocity":
The velocity (height) of the first jump.
"SecondJumpVelocity":
The velocity (height) of the second jump.
"FirstJumpAction":
The action that happens when the first jump happens.
"SecondJumpAction":
The action that happens when the second jump happens.
"NoCollisionAcitonOnFirstCollision":
Decides if the collision action should not happen when the very first collision happens.
"CollisionAction":
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):

"DisableJump":
if equals 1, disable jumping. Useful if you dont want to allow the player to jump during
cutscenes and such.
"DisableDoubleJump":
if equals 1, disallow a second jump. Useful for double jump to be an unlockable or not to be
allowed at all.
"InfiniteJumps":
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:

"behavior_doubleJump_resetValues();":
Reset the values of all the global variables within this behavior. Useful for reseting the check
for the very first collision.


Download:
https://www.mediafire.com/file/j...

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)


Text:

 

  

Forum Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons