Manual: DisplayDirection and FaceDirection

In ACTION GAME MAKER, each state includes a system called DisplayDirection, which plays animations according to the object’s orientation.

This manual explains how to control DisplayDirection.

For details about animation sets that support DisplayDirection, please see:


Overview of the DisplayDirection System

DisplayDirection can be configured for 8 directions.


Setting DisplayDirection

DisplayDirection can be changed in each state under the “DisplayDirection” setting.

In addition, by using the FaceDirection configured via the FaceDirectionSettings node, more detailed control is possible.


“DisplayDirection” Setting in Each State

DisplayDirection can be set to one of the following:

  • Movement Direction: Always synchronizes with the current movement direction.
  • Movement Key Direction: Always synchronizes with the direction of the movement key input assigned to the object.
  • Right/Left: Always faces either right or left.
  • Use FaceDirectionSettings: Faces according to the FaceDirection configured in the FaceDirectionSettings node (explained below).

The configured DisplayDirection is maintained while the object remains in the same state.


FaceDirectionSettings Node (FaceDirection Settings)

This node is used to specify the FaceDirection.

It functions by being placed as a child of the object.

The following settings are available in FaceDirectionSettings:

  • Movement Direction: Always synchronizes with the current movement direction.
  • Movement Key Direction: Always synchronizes with the direction of the movement key input assigned to the object.
  • Do Not Change (Free): Does not change the DisplayDirection until modified by an action or script.
  • Specified Object’s Direction: Faces the direction of a specified object.
  • Specified Group: Faces the direction of the nearest object in the specified group.

Each setting in FaceDirectionSettings can also be changed using the execution action
ChangeObjectProperty.

Although FaceDirection is a separate variable from DisplayDirection, as mentioned earlier,
you can use FaceDirection as the DisplayDirection in each state’s DisplayDirection setting.


Execution Action: ChangeFaceDirection

This action changes the FaceDirection.

It does not directly change DisplayDirection, but only the FaceDirection itself.

Therefore, if the state’s DisplayDirection setting is “Use FaceDirectionSettings”, and the FaceDirectionSettings is not set to “Do Not Change (Free)”, any manual change may be immediately overwritten. Please use caution.

The following options are available in ChangeFaceDirection:

  • Angle: Specify an angle from 0° to 360°, where right is 0°.
  • Direction: Select directly from 8 directions.
  • Variable: Use a variable value as degrees to specify the direction.
  • Movement Direction: Face the movement direction at the time of execution.
  • Specified Object: Face the direction of a specified object.

DisplayDirection and the DisplayDirection Variable (visible_direction)

The visible_direction variable represents the current facing direction in 45-degree increments.

Examples:

  • Right: 0°
  • Down-Right: 45°
  • Down: 90°

This variable only indicates the current facing direction as a convenience value.
Assigning a value to this variable will not cause any change.

Therefore, if you want to change the direction relative to the current direction, you can follow these steps:

  1. Assign the visible_direction variable to another variable A.
  2. Add the desired angle value to variable A.
  3. Use the ChangeFaceDirection action to change the facing direction based on variable A.

Practical Usage Examples

Mario-style Sliding Movement

By setting the movement mode to Acceleration in MoveAndJumpSettings and setting the Face Direction to Movement Key Direction, you can achieve Mario-style movement where the character brakes while facing the opposite direction.


Facing an Arbitrary Stick Direction Without Movement

This can be achieved using ChangeAngleSettings and facing toward a group.

Steps:

  1. Add a Node2D as a child of the GameObject and rename it to TargetRoot.
  2. Add another Node2D as a child of TargetRoot and rename it to Target.
  3. In the Inspector for the Target node, set its Transform position to x = 100, y = 0.
  4. Add an arbitrary group name to the Target node.
  5. Add ChangeAngleSettings as a child of the GameObject.
  6. In the ChangeAngleSettings Inspector, enable Use Right Stick or Use Left Stick, and set TargetRoot as the target node.
  7. In FaceDirectionSettings, set it to follow the group assigned to the Target node.

How This Works

The ChangeAngleSettings node rotates the TargetRoot node according to stick input.
Since the Target node is offset to the right of TargetRoot, rotating TargetRoot causes Target to move in a circular path.
FaceDirectionSettings follows this rotating Target node, resulting in the object facing the stick direction.


Facing the Mouse Cursor

First, create an object for the mouse cursor.

Steps:

  1. Create a new GameObject using the template GDScript_sample, and select the type SimpleCursor.
    SimpleCursor is a node with a script that constantly follows the mouse position.
  2. Save the SimpleCursor and place it in the UI layer of the game scene.
    (If placed in a normal layer, it may be affected by offsets and other transformations.)
  3. In FaceDirectionSettings, set the target object to follow the SimpleCursor.

Additional Note

You can achieve the same behavior by enabling Use Mouse in ChangeAngleSettings in the previous example (“Facing an Arbitrary Stick Direction Without Movement”).