Objects

In GDevelop, everything on the screen is an object. This includes — but is not limited to — the playable character, enemies, and parts of the environment.

You can create different types of objects for different purposes. For example, Sprite objects add animated graphics to a game, while Text objects add text to a game.

You can also use behaviors to add functionality to objects and create events that affect an object's attributes (position, size, etc).

List of objects

This section lists the different types of objects, each of which serves a unique purpose.

Refer to the linked pages to learn more about each type of object.

Some objects are experimental. They're under development and are more likely to change than the non-experimental objects.

Creating an object

  1. Open the Scene editor. This is the default view after creating a new project.
  2. In the Objects panel, select Click to add an object.
  3. In the Add a new object dialog, select a type of object.
  4. Configure the object. The available settings depend on the type of object.
  5. Select Apply.

Adding an instance of an object to a scene

After creating an object, GDevelop doesn't immediately add it to a scene. You need to add the object to the scene via the Objects panel. You can add as many copies of the object to the scene as you like.

Each copy of an object in a scene is referred to as an instance of the object. All instances of an object share the same underlying behavior as the original object, but you can customize them independently of one another. For example, each instance of an object may have a different position in the scene.

Modifying an instance of an object

If you select one or more instances of an object, the Properties panel appears on the left side of the screen. This panel displays information about the selected instance(s).

You can customize the following properties of an object's instance:

Position

All objects have coordinates. These coordinates correspond to the horizontal position (X-axis) and the vertical position (Y-axis) on the Cartesian plane. The X-coordinate decreases as you go to the left and increases as you go to the right. The Y-coordinate increases as you go down and decreases as you go up.

Angle

The Angle option defines the rotation of an object in degrees. The following illustration demonstrates how GDevelop understands the angle of rotation:

If you use trigonometric functions like the sine or the cosine, you need to express the angles in radians. (1 radian = 180/PI degrees and 1 degree = PI/180 radians. PI is the number which is approximately equal to 3.14159). You can use expressions ToRad and ToDeg in events to convert between degrees and radians.

Z Order

When objects on the same layer overlap, the Z Order of the object determines whether the objects appear in front or behind one another. For example, an object with a Z Order of 2 appears in front of an object with a Z Order of 1.

In the following image, the Z order of the bush on left is 2, the Z order of the coin is 1, and the Z order of the bush on the right is 0:

The value of the Z Order field can be any integer, including negative numbers and zero.

Layer

All objects exist on a layer. Objects are then drawn onto the screen layer-by-layer, from bottom to top. This means an object on the top layer will always appear in front of objects on the bottom layer (even if the objects in the bottom layer have a higher Z Order value).

Typically, background objects, interactive objects (such as the playable character), and UI objects exist on different layers, but there are no strict requirements.

Lock position/angle in the editor

Sometimes, a scene has a lot of objects and it's difficult to select a specific instance. If you enable the Lock position/angle in the editor option, you can no longer select the instance, which makes it easier to select the instance you do want to select.

Instance variables

An instance variable is a variable that's specific to an instance of an object. The Instance variables table lets you define the variables attached to the instance and the values of those variables.

For more information, refer to Object variables.

Custom size

If enabled, you can change the height and width of the object instance. This height and width is distinct from the dimensions of the original object.

Instance timers

Each instance of an object living on the scene can have timers set during the game with events. See the page about timers to learn more about these.

Visibility

By default, object instances are all marked as visible, meaning that they are displayed on the screen. Using events, you can hide any instance during the game. An hidden object instance won't be displayed anymore, but will still live on the scene (reacting to collisions, and following all other events as usual).

Some objects, like Sprite or Text objects, can also have an opacity. The opacity, between 0 and 255, defines how transparent an object is (0 being fully transparent, 255 is the fully opaque and is the default). This can be changed independently from the visibility.

Organizing objects into groups

You can organize objects into groups and then refer to all of the objects in that group by a single name.

This makes it possible to create events that applies to lots of objects without repeating events multiple times, increasing performance of your game, maintainability, and readability of your events.

To organize objects into groups:

  1. In the toolbar, select the Groups icon.
  2. Select Click to add a group.
  3. Select the group.
  4. In the Edit group dialog, select the objects to add the group.
  5. Select Apply.

By default, the name of a group is “Group”. To rename a group, right-click the group and select Rename.

In the events editor

You can change and manipulate the properties of an instance of an object, or of multiple instances, using events during the game. This is even what game making is all about in GDevelop: to manipulate objects in real-time as we play the game. As the events and events editor are out of the scope of this page, refer to the basic game making concepts page to get started.

  • All objects share the same common features (like position, angle and everything that is written on this page), and there are a lot of conditions and actions that you can use for all objects.
  • Objects can also provides you with specific feature. For example, Sprite objects can have animations, and the animation being played can be changed using an action. Find more information in the page of each specific object.