Actions¶
The Motion Actions asset empowers both Traverse Link and Traverse Interactive components with custom skills that can be performed while traversing an obstacle.
It is composed of two built-in skills (Cancel and Jump), and a list of Actions and States that allow you to configure them however you want.
To create a new Motion Actions, right-click on the Project Panel and select Create → Game Creator → Traversal → Motion Actions.
Asset¶
The Can Cancel boolean property determines whether a character can cancel, or let go of, the Traverse component that has this Motion Actions assigned.
The Can Jump boolean property determines if a character can attempt to jump from the Traverse component that has this Motion Actions assigned.
If a character can jump, the Custom Jump Force allows customizing the jump force. If this toggle is disabled, the character will jump using its default jump force configured in the Character component.
The Dash On Jump checkbox allows replacing the jump with a Dash ability. This is useful for situations where you want more fine-grained control over the direction in which a character goes.
When to use a Dash instead of a Jump
Some obstacles, such as Wall-Running walls, allow characters to jump forward and diagonally in order to jump onto another wall-run that is on the opposing side. For cases where the character shouldn't jump straight up, dashing is the perfect option.
The Local Direction is the local direction from the Traverse component in which the character will dash. Speed is the magnitude of the dash and Duration determines the amount of time the character will go on dashing without the player being able to control the character.
The Actions and States lists are used to create custom skills for the character when traversing the environment.
Actions¶
Actions are one-off events that can happen when the character is traversing an obstacle. These events may have a duration but once it finishes playing, it goes back to its original state.
Example of Motion Actions Action
For example, if the player is climbing a wall, they can use an Action to hit with the sword another character that is also climbing above them.
Click on the Add Action... button to add a new Action value, which is identified by its unique ID name.
Whenever an Action runs, it executes the Instructions below, and ticking the Exits toggle will make the character automatically exit/cancel the current Traverse component.
States¶
States on the other hand are events that the character can enter and stay until the character manually exits it, or the character exits the Traverse component.
Example of Motion Actions State
For example, if the player is in low cover, you can use a State to pop up from cover and aim with the current weapon while holding a button. Releasing the button can make the character exit the aiming mode and return back to being covered.
Click on the Add State... button to add a new State value, which is also identified by its unique ID name.
The Allow Movement toggle determines whether the character can move around the Traverse bounds while in this State.
The On Enter and On Exit instructions are executed whenever the character enters and exits the State, respectively.
Using Motion Actions¶
Interacting with a Motion Actions is all done using Instructions, and there is one for each of the 2 built-in skills and another 3 for Actions and States.
-
The Try Motion Jump instruction attempts to perform a jump on a character that is currently on a Traverse component.
-
The Try Cancel Traverse instruction attempts to cancel traversing an obstacle. This is similar to the Exit Traverse Interactive instruction, except that this instruction will only work if the Traverse component has a Motion Actions with the Can Cancel property evaluating to true.
-
The Try Motion Action accepts an ID name that will attempt to execute an Action found in the Motion Actions assigned to the current Traverse component.
-
The Try Motion Action State Enter and Try Motion Action State Exit accept an ID name that will attempt to enter or exit a State found in the Motion Actions assigned to the current Traverse component.
Note that all these instructions have the Try prefix before them. This is because if the character isn't on a Traverse component, the Traverse component doesn't have a Motion Actions or the asset can't find an Action or State with the specified ID name, it won't execute anything.
Sharing IDs with multiple Traverse components
The fact that Actions and States are identified by an ID can be leveraged to create common mechanics throughout all Traverse components. For example, if you are making a shooter game where the player can shoot from cover and while climbing, you can create two Motion Actions assets for both types of situations, but they both have a State with an ID called aim
.
By doing so, you can decouple the aiming system from the traversing, and create a Trigger that detects when the aim button is pressed and released, and use the Try Motion Actions State Enter and Try Motion Actions State Exit, respectively.
These instructions will only do something if the character is currently on a Traverse component that accepts aiming. In all other situations, it won't do anything.