Jump with Button

Description

The Jump with Button behavior will allow you to make any physics object jump using an on screen button. If there is no button in your scene, the behavior will automatically add a button to your Global UI layer (deleting the behavior will not remove the button from your scene). This behavior contains predefined properties to make the creation of certain games easier. It's perfect for platformers, and side scroller shooters.

 

Note: The bottom of the object must be touching a surface for the object to jump. E.g The characters feet need to be touching the ground for it to jump.

 

The Jump with Button behavior offers a lot of properties to customize the feel of your game. Try modifying the properties so your game doesn't feel like a generic platformer. For more advanced and in-depth games, it is recommended to create your own jumping system using the other physics, or move behaviors.

This behavior will Trigger an event once when you press the jump button.

 

Properties

Triggers Once on Event

Object A

This is the button that will be used to make Object B jump. It will automatically select a button added to your Global UI layer. If there is none, one will be created automatically.

Object B

This is the object you want to make jump. By default the current object is selected, but you can tap the graphic to change it to any other object in your scene. 

Power

This is how much much jumping power your object will have. The greater the power, the higher the object will jump. Keep in mind other physics properties, like gravity will affect how high the object can jump. The default value is 15.

# Jumps

This is how many times your object can jump before landing on the ground. If you want your character to double jump set it to 2. The default value is 1.

Wall Jump

The wall jump toggle will indicate whether your object can jump off walls or not. When it is on, your object can jump off a wall. By default this is off

Auto Flip

This toggle is only available when Wall Jump is on. This will flip your object to the opposite direction after jumping off a wall. By default this is on when you toggle on Wall Jump.

Lock Rotation

This will prevent your object from rotating. This includes any rotation caused by other objects or physics in your scene. For example, you can turn this on to prevent your character from tipping over. By default, this toggle is on.

Play Animations

When this toggle is on, your object will play an animation when the jump button is pressed. You must select an animation from the Custom Animations panel.

Custom Animations

On the left panel, you can select animation cycles to play when you press the jump button. For jumping there are two states, the initial jump, and a falling animation.

Animation Priority

On the left Custom Animations panel, you can prioritize your jumps animations so it does not conflict with another playing animation. The animation system will play a cycle with a higher priority. So if another animation behavior is interrupting your jump animation, try increasing the priority.

Sound 

Select a sound to play each time the jump button is pressed.

 

Outputs

Object ID

Outputs the object's ID.

 

Examples

If you want to make a platform game like Mario, you can simply add this behavior to your player object, and it will automatically create a button on your Global UI layer, and make your character able to jump.

 

Related

Joystick Controlled

Jump

 

JumpWithButtonReference.gif

0 Comments

Article is closed for comments.