CurrentMovement
Last updated
Was this helpful?
Last updated
Was this helpful?
The CurrentMovement property controls the values used by the top down entity in response to input. The CurrentMovement property can be assigned in code in response to various conditions in your game such as:
Collision with different terrain (such as walking through mud)
Responding to power-ups (such as collecting a power-up which increases speed)
Responding to special moves or input which changes the character's movement variables (such as holding down a run button)
Movement values can be defined in the FRB editor or code. If your game has a limited set of movement values, these can be defined in the FRB editor. To do so:
Select an entity
Click the Entity Input Movement tab
Verify that your entity is using the Top Down option for Input Movement Type
Click the Add Movement Type button
Modify the newly-added movement values as necessary
The Top Down tab displays all movement values for the selected entity.
You can assign the current movement values in code through the CurrentMovement
propety. For example, the following code assigns the movement to FastMovement
or Default
depending on the state of an Xbox360GamePad
:
Derived entities can override movement values which are defined by their base entity. For example, consider an Enemy entity with two movement types: Idle and Walk.
A derived entity automatically inherits these movement values as shown in the FRB editor.
Notice that these values are read-only, but they can be overwritten by checking the Overwrite Values radio button.
The name of movement types cannot be changed when overwriting values; however derived entities can add additional movement variables which do not exist in their base.
At runtime the derived entity merges the overwritten values with the base values. For example, the Slime enemy has two movement values, but its Walk value has a max speed of 150 instead of 76.