Top-Down Movement behavior

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

Add behavior to object

To add the Top Down behavior to an object, first, open the object properties by accessing the object in the object menu or by right-clicking on the object in a scene. Select “Edit object” from the popup list. Then select “Behaviors” and click the add behavior button.

Top-Down Movement behavior

By selecting the Top Down Movement behavior from the list, we add the functionality to our object.

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 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.

Default controls

The Top Down Movement behavior comes with default controls enabled. The default controls are the four keyboard arrow keys. If we would like to use custom controls to move the object we need to disable this option by unchecking the box and after we need to use the top down movement events to move the Object.

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.

We can also change any of these options by using events found in the “Events” tab section of GDevelop at any time during the game.


See it in action! 🎮
Open these examples online.

Space Shooter

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