Concepts

The basic concepts of GDevelop are simple. Read the following information to get started with the program.

Coordinate system

Objects on the scene have an X and a Y coordinate, corresponding to the horizontal position (X-axis) and the vertical (Y-axis) position on the Cartesian plane.

The mouse coordinates are shown in the Scene Editor status bar:

As shown below, the X-coordinate decreases as you scroll to the left and increases as you scroll to the right, while the Y-coordinate decreases as you scroll upwards and increases as you scroll downwards.

In order to move or rotate objects, you will need to specify the desired angle in degrees. See below how GDevelop understands the angle rotation:

If you use trigonometric functions like the sine or the cosine, note that you will have to express angles in radians. ( 1 radian = 180/PI degrees and 1 degree = PI/180 radians, PI being the number which is approximately equal to 3.14159 )


Object selection by events

Most conditions and actions refer to objects, the former to test and the latter to modify them. An action without a condition will refer to all objects. If you use an object for the first time in an event, GDevelop will test or modify all objects with this name in the scene. If you use the object in the same event again, GDevelop will test or modify only the objects which have been picked by the previous conditions.

This process is a mere application of logic. This event will delete all objects called “Square”:

This event will instead delete only the “Square” objects with X position inferior to 100 pixels:


Events: the order is important

The event order is important: events at the top are executed first. So the following event pairs are not equivalent:

The first pair creates a “Square” object in position 200;100 and then deletes it. No “Square” is displayed on screen.
The second pair deletes all “Square” objects from the scene, and then creates one “Square” in position 200;100, so the square remains visible.


Moving objects using built-in forces

Moving objects can be achieved thanks to forces, which are used to “pull” objects.

You can specify the Cartesian coordinates of a force (i.e. X and Y, in pixels), its polar coordinates (the force vector angle and length), and the force dispersion, a coefficient between 0 and 1. Each second, the force length will be multiplied by the dispersion: a value of 1 means that force will continue forever, a value of 0 will make it stop immediately. All intermediate values will cause the force to gradually stop.

Example

Say you want to move an object towards the bottom:

You can add a force using X/Y coordinates, specifying 0 for the X coordinate and, say, 150 pixels for the Y coordinate. You can also use polar coordinates and add a force with an angle of 90° and a length of 150 pixels.

Others means of moving objects

Some extensions like the Physics or Pathfinding behaviors may move the objects using their own system. In this case, it is better not to use the builtin forces system and instead rely only on actions provided by the extensions used.


Variables

Variables allow you to store data, for example a number or a text. We might compare them to drawers or boxes where we can file notes. Any data can be stored, as long as it is in text or number format: number of lives remaining, high-score, bullets left, killed enemies, etc… You are probably going to use numbers often.

Actions and conditions test or change a variable value.


Variable scope

The scope of a variable determines where a variable can be accessed. In GDevelop, three variable scopes are available:

Global variables are accessible from all the game scenes; for instance, they can be used to store the player's score across different levels;
Scene variables are only accessible from a scene. They can be used for data that only concern one scene and not the entire game, like the time remaining before an explosion;
Object variables only concern one object. For example, a hero can have a “Health” or “Ammo” variable.


Time elapsed since last frame (TimeDelta)

The game evaluates events and repaints the screen several times per second: we say that the game is refreshed. How often this happens depends on your computer resources: a slow computer can render 25 frames per second, a fast one 140. GDevelop can usually make sure that this value is the same on all computers, however the speed of some operations can change from computer to computer, for example mathematical operations and the rendering of movements.

To make the speed of changes constant, use the TimeDelta() expression, which returns the time in seconds since the last frame. For example, do not do the following:

But do this instead:

The first event is adding 20 to the variable every time the game is refreshed ( i.e. as much as possible ). It's not correct to use a such event as the speed of the increase of the variable will not be the same from computer to computer: We cannot predict the value of the variable after 10 seconds for example.
The second event is correct and reliable : The number 300 is multiplied by TimeDelta(). Thus, the variable will be increased at the same time on all computers. As TimeDelta() returns a time in second, it allows you to quantify exactly the amount: In our case, the variable will grow at 300 unit/seconds. Thus, we can predicate that the life will increase by 3000 units in 10 seconds.

Remember to use TimeDelta when you want to continually add some amount to a value.

When you're moving an object using forces, there is no need to use TimeDelta() as GDevelop automatically uses it.

And that's almost all you need to know

You can continue to read the Getting Started page to see an overview of GDevelop interface.