Jumping

Jumping post thumbnail image

OpenBOR includes a robust native jumping system. In most cases you don’t need to do anything at all other than add your jumping and jumping attack animations. Use the following animations and properties to set up dynamic and nice looking jumps.

Animations

Jump

anim jump

Defining a JUMP animation in model text enables jump ability for the entity. When jumping, the entity plays JUMP from liftoff until touching the “ground” again. If the JUMP animation does not have a loop, the last frame plays until landing. Jumping trajectory and distance are controlled with jumpheight and jumpspeed properties (see below).

Players

Jumping is mapped to the Jump button by default. During a jump players may execute one or more jump attacks (see below).

AI

If available, AI controlled entities will use JUMP to ascend platforms and traverse pits. This is controlled by the JUMP animation’s range setting.

  • Distance to the obstruction must be equal or less than the minimum range setting.
  • The height of wall or platform must be within maximum range setting.
  • In the case of a pit, the total width must be equal or less than maximum range setting.

Assuming these conditions are met, the AI will jump.

Tip: Set up ranges carefully compared to the model’s jump trajectory settings. As an example, setting up short jumping trajectory with long ranges could lead to entities stupidly jumping into pits or repeating futile attempts to get onto a platform.

Jumpdelay

anim jumpdelay

If available, plays immediately before a jump initiates. Entity leaves ground and plays JUMP when this animation completes. Used mainly to create a standing to jump transition. The typical example is an entity crouching briefly to prepare for liftoff.

This animation only plays for native jumping. Use visual jump start frames frames immediately before animations with jumpframe or scripted jumps.

Jumpland

anim jumpland

If available, plays immediately after a jump lands. The typical example is an entity crouching briefly to absorb the impact of landing.

This animation only plays for native jumping. Use landframe or for scripted jumps, falls, etc.

Forwardjump

anim forwardjump

If available, replaces JUMP when entity jumps while moving.

Runjump

anim runjump

Running jump trajectory is a multiplier of the model’s existing jump trajectory settings. The multiplier is controlled by model’s running property.

Player

If available, replaces JUMP when entity jumps while running. If players have running configured but no RUNJUMP, then JUMP or FORWARDJUMP plays instead, but running jump trajectory still applies.

AI

If available AI uses RUNJUMP with logic identical to JUMP. If the obstacle to traverse falls with range of both JUMP and RUNJUMP, the AI prioritizes JUMP. Note the AI does not require a “run up” before executing a running jump.

Tip: Setting up both JUMP and RUNJUMP gives the AI more adaptive jumping capabilities just like a player controlled entity. With properly configured ranges the AI will use a normal jump to clear shorter distances, and a running jump when more height or reach is needed.

Walkoff

anim walkoff

If available, plays when walking off a ledge (walls, platforms, holes, etc.). Not technically a jump. You will need to use landframe to add a landing sequence.

Jumpattack

anim jumpattack

Players

If available, this animation is mapped to the Attack button while jumping.

AI

If available, AI controlled entities will play this animation when a target is in its range settings. While doing so, the entity is tossed forward using its jump trajectory settings.

Tip: JUMPDELAY is not performed when this attack starts. If you want a fully animated prepare->jump->attack->land sequence for AI controlled entities, consider using a FREESPECIAL# with jumpframe and landframe.

Jumpforward

anim jumpforward

Replaces Jumpattack when player is in a moving jump. The AI does not use this animation on its own.

Runjumpattack

anim runjumpattack

Replaces JUMPATTACK when player is in a running jump. The AI does not use this animation on its own.

Jumpattack2

anim jumpattack2

Players

Players execute this animation with Down + Attack during a jump.

AI

Identical to JUMPATTACK, except the entity jumps vertically.

Tip: Has the same caveats as Jumpattack. Consider using Freespecial# for AI controlled jumping attacks.

Jumpattack3

anim jumpattack3

Players execute this animation with Up + Attack during a jump. The AI does not use this animation on its own.

Configuration

Global

Unless noted otherwise, global properties are part of the models.txt file.

Default Jump Height

jumpheight <float>

# Default
jumpheight 4.0

Global default for all model jump heights. Also affects legacy Throw Distance.

No Air Cancel

noaircancel <int>

# Default
noaircancel 0

Controls player air canceling.

  • 0: Players can cancel any air attack with a different air attack (ex. Jumpattack -> Jumpattack2).
  • 1: Players can cancel air attacks after the animation is complete.
  • 2: Players cannot cancel air attacks.

Model

Model header properties.

Air Control

air_control <flags>

# Default
air_control none

Configures player control options when jumping (for this model). Accepts one or more of the following flags in any order. Note, if used, you must include all flags you want to enable.

  • none – No configuration. Has no effect if any other flags are set.
  • jump_disable – Entity cannot jump at all.
  • jump_turn – Change direction in air with Left/Right.
  • jump_x_adjust – Change horizontal velocity in air with Left/Right if already moving on horizontal axis.
  • jump_x_move – Change horizontal velocity in air with Left/Right any time.
  • jump_x_stop – Lose horizontal momentum when not holding Left/Right.
  • jump_y_stop – Lose vertical momentum when not holding Jump (IOW Mario Brothers style jump height control).
  • jump_z_adjust – Change lateral velocity in air with Up/Down if already moving on lateral axis.
  • jump_z_initial – Can initiate a lateral jump.
  • jump_z_move – Change lateral velocity in air with Up/Down any time.
  • jump_z_stop – Lose lateral momentum when not holding Up/Down.
  • walkoff_turn – Same as jump_turn, for walkoff.
  • walkoff_x_adjust – Same as jump_x_adjust, for walkoff.
  • walkoff_x_move – Same as jump_x_move, for walkoff.
  • walkoff_x_stop – Same as jump_x_stop, for walkoff.
  • walkoff_z_adjust -Same as jump_z_adjust, for walkoff.
  • walkoff_z_move – Same as jump_z_move, for walkoff.
  • walkoff_z_stop – Same as jump_z_stop, for walkoff.

Example: Player can control jump height by how long they hold the jump key, jump laterally, and turn around in the air when jumping.

air_control jump_turn jump_y_stop jump_z_initial

Script accessible as air_control model property. Use following bitmask constants:

  • openborconstant("AIR_CONTROL_NONE") – Assign directly (not a mask) to reset all flags off.
  • openborconstant("AIR_CONTROL_JUMP_DISABLE")
  • openborconstant("AIR_CONTROL_JUMP_TURN")
  • openborconstant("AIR_CONTROL_JUMP_X_ADJUST")
  • openborconstant("AIR_CONTROL_JUMP_X_MOVE")
  • openborconstant("AIR_CONTROL_JUMP_X_STOP")
  • openborconstant("AIR_CONTROL_JUMP_Y_STOP")
  • openborconstant("AIR_CONTROL_JUMP_Z_ADJUST")
  • openborconstant("AIR_CONTROL_JUMP_Z_INITIAL")
  • openborconstant("AIR_CONTROL_JUMP_Z_MOVE")
  • openborconstant("AIR_CONTROL_JUMP_Z_STOP")
  • openborconstant("AIR_CONTROL_WALKOFF_TURN")
  • openborconstant("AIR_CONTROL_WALKOFF_X_ADJUST")
  • openborconstant("AIR_CONTROL_WALKOFF_X_MOVE")
  • openborconstant("AIR_CONTROL_WALKOFF_X_STOP")
  • openborconstant("AIR_CONTROL_WALKOFF_Z_ADJUST")
  • openborconstant("AIR_CONTROL_WALKOFF_Z_MOVE")
  • openborconstant("AIR_CONTROL_WALKOFF_Z_STOP")

Equal Air Pause

equalairpause <int>

# Default 
equalairpause 0

Pausing behavior when hitting another entity with attacks while in the air. Attacks normally add their pause effect to attacking entity if the entity is not already paused longer than the attack’s pause, or any time attacking entity is in the air.

  • 0 = Hit pause added any time entity is in the air.
  • 1 = Follow same rules as an entity at base height.

Jump Speed

jump_speed <float>

# Default: Special, see below. 

X Axis toss velocity when jumping forward. Default value is the model’s speed or 1.0, whichever is higher.

Jump Height

jump_height <float>

# Default: Special, see below. 

Y axis toss velocity when entity jumps. For backward compatibility with BOR, Jump Height also affects the following:

  • Default animation ranges.
  • Default jumpframe velocities.
  • Y axis toss of the legacy Throw animation.
  • Y axis toss for Bomb type projectiles.

The default is controlled by global Default Jump Height property.

Related Post

FilestreamFilestream

Under Construction Filestreams allow CRUD (Create, Read, Update, Delete) operations on user defined files during gameplay. You can sue these to build databases and add persistence features to games.