Skip to content

Top-Down Movement behavior

Add "Top-Down Movement" behavior

The "Top-Down Movement" behavior allows the additional functionality of moving an object in either 4 or 8 directions.

After selecting the behavior, we should immediately see the available options:

Change the speed of movement and rotation

By changing the value of Acceleration, Deceleration and Max speed, we can change how fast our object is going to move.

By changing the value of Rotation speed, we can change how fast our object is going to rotate or if it going to rotate at all. I'll explain more about rotation, below.

Change angle offset

By default, the facing angle of our sprite is 0 which is the right side of our sprite, but we can change the way that our object is facing by changing the value of Angle offset. Here is an image to help you understand the coordinates in GDevelop:

Note

Note that some expressions like AngleBetweenPositions can gives you a result between -180 and 180. This is equivalent to this schema. An angle of -45 degrees is equivalent to an angle of 270 degrees.

Allows diagonals

This option is enabled by default. We allow our object to move diagonally in 8 directions. By disabling this option, we don't allow diagonal movement. When disabled, we can move only in 4 directions: left, right, up and down. Diagonal movement is no longer allowed.

Controls

Move characters with keyboards

The "top-down movement" behavior comes with default keys set to control the character. The default controls are the four keyboard arrow keys. If you don't want to use the default controls, you need to turn off the default controls by unticking/unchecking the "Default controls" box and use keyboard conditions instead.

Move characters with gamepads

The "top-down gamepad mapper" behavior from the gamepad extension can be added to character to make them move according to players inputs automatically.

Move characters with multi-touch controls

The "top-down multitouch controller mapper" behavior from the multi-touch joystick extension can be added to characters to make them move according to players touches automatically.

Rotate object

By default, our object will rotate toward the direction of movement. The object will rotate at the speed we specify in the Rotation speed option. If we don't want the object to rotate, we need to disable this by unchecking the box.

All theses values can also be changed at any time during the game using events.

Examples

Tip

See it in action! 🎮

Open these examples online.

Space Shooter

Open example in GDevelop

Isometric Game (creates an illusion of 3D graphics within a 2D graphics game)

Open example in GDevelop

Reference

All actions, conditions and expressions are listed in the top-down movement reference page.