**This is an old revision of the document!**

Common features to all objects

In a GDevelop game everything is an object.

Add an object to our game

We can add objects to our game by simply clicking the add object button on the right

We can choose from many different type of objects with unique functionality and purpose.

After, depending on what type of object we have created, we have access to some unique properties. As the goal of this page is to explain objects in general, we won't go in to details of this unique properties on each type righ now. You can find detailed information on each type of object on the wiki.

Add an instance to our scene

We can add an object to our scene by selecting the object in the Object tab and then click in our scene to place an instance of that object. An instance is basically a copy of the object.

Add objects to groups

We can add objects to groups. To do that just click the groups icon on the top Once you clicked, it should open up the Objects groups tab where you can see the list of groups you might have. To add a group click the add group button After that you should see a new group in the list. To rename the group, right click on the group and select rename. To add objects to the group, right click on the group and select edit group.

In the next window click the choose object to add to group button and choose the objects you want to be the member of this group. Once you're done just click the Apply button on the bottom right corder

The purpose of the groups is that when you start making your game you can refer to a group instead of each object one by one. For example, you may want to add all kind of enemies to a group called “Enemies” and once you done that you can just simply refer to the group “Enemies” when you want to do something with all kind of enemies in your scene not just a specific kind or a specific one but to all of them. Maybe freeze them all for a second when the player apply a special ability.

In the scene editor

We can change the position of an object by selecting the object in the scene editor and drag it. We can scale the object by selecting the object and drag one of the white scale points

In the Properties tab

When we select an object in the scene editor, we should see the Object properties on the left and we can change more properties there. If it not open we can re-open it by clicking the properties button on the top

Position

We can change the position of the selected object by changing the X and Y values in the object properties tab

Angle

We can change the angle of the object by changing the angle value in the properties tab The angle can be any value from 0 to 360 note: The angle rotation is based on the default center points of the object/sprite. Changing the center or origin does not affect the angle rotation.

Z order

We can change the Z order of an object by changing the Z order value in the properties tab The purpose of the Z order is basically to change the position of the sprite on the Z axis and by doing so we can control if the object is behind an other object or it is in front. We can use any value here. The lower value means the object is lower in the order and the higher value means it is higher. On the above 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.

Layer

We can change the layer of an object in the properties tab By default each GDevelop scene comes with a single layer called the “Base layer” and this is where all objects are located in our scene but we can add more layers for various purposes and put any object on to any layer we wish. For example we can use a layer to add on screen controls or to add a menu, a map..etc only our creativity is the limit what we are going to use a layer for.

Lock

We can also lock the selected object by ticking the box in the properties tab The purpose of this feature is to lock the sprite so we can not longer select it in the scene. There are times when we have lot of objects overlapping each other in our scene and it is make it difficult to select some of them as we keep selecting the ones we don't intend to. In such cases, we can lock the sprite so we can not select it and move it incidently. We can unlock a sprite by opening the instances tab which is displaying all the instances in our scene and select the object from the list.

Instance variables

We can add variables to our objects by clicking the edit variables button
Variables are a whole new topic so we wont go in to details right now but a variables is basically a container that is holding some sort of value and we can compare and change this value at any point in our game. There are different type of variables in GDevelop. In this case the value inside an instance variable is going to be unique to our instance of the object. So for example we can use an instance variable to store the health of each individual enemy instance in our game and if the value of enemy health is 0 we wont kill all the enemies but only the ones that health variable is actually 0 and because the instance variable is unique to each individual instance, GDevelop going to know which instances need to be killed.

Timers

Objects can hold their own timers, and each timer will be unique for each instance. Object timers are useful to make instances to launch actions after/every X seconds.
A classical use would be to simulate fire rates: If you have a single tank enemy you could use a scene timer so every 3 seconds this tank can fire (create a bullet) and reset the timer so the tank can shoot again; now if you have 2 tanks and use a scene timer you'll notice both tanks shoot at the same time, because they are sharing the same scene timer, so you should create a second scene timer, independent from the first one to make the second tank to shoot; but if you have 100 tanks?, will you create 100 scene timers, one per instance?… you could… but here's when object timers give you a hand, replacing every condition/action using the scene timer with the conditions/actions to use object timers GD will do the job for you and create a timer inside each tank instance!, and it will work as you expect, check if the timer “fire_rate” of tank is greater than 3 seconds will pick the tanks that can shoot only, reset the timer after shooting will reset the timer of the shooting instances only, etc.

You can read more about timers here: Timers

Custom size

We can change the size of our objects by enabling the custom size in the properties tab and enter the custom Width and Height dimensions in pixel

Origin & Center

The origin and the center points can be edited by right clicking on the object in the objects manager, selecting “Edit Object”, and then clicking on “EDIT POINTS”.

This is helpful if you have objects that need to be scaled uniformly in all directions, as the default origin for all objects are located at the top left, (0,0). Keep in mind that changing the points of an object will affect all events associated with the need for positioning and movement/location, etc. It is therefore best to change this, when needed, at the beginning of creating the object.

In the events editor

We can change and manipulate the properties of an instance or group of instances also using events. And this exactly what game making as all about in GDevelop, to manipulate objects in real time as we play our game and we can do just that using events. As the events and events editor is out of the scope of this page, we won't go in to details right now but only share some example projects that you can open and play around with it. To give you a kick start, We can show you where the events editor is located.

The events tab

To open the events editor, just click the events tab on the top next to the scene tab. It should be in the format “scene-name(EVENTS)”. By default our scene is called “NewScene” so don't be surprised to see maybe “NewScene(EVENTS)” instead.

Once you clicked, you should see all the events below that actually make our game. You can find more information on the events on the wiki