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

Layers and cameras

A layer acts as a virtual container for objects displayed on the screen. Objects are drawn on a layer, which is by default the “base layer”, and the layer is then drawn on the screen. A scene can have multiple layers. If a layer is below another layer, the objects on the former layer will be displayed under all the objects of the latter - whatever their Z order.

You can think of layers as sheets of transparent paper that you put on the top of each others.

To create a new layer or edit existing ones, open the layers editor using this button:

In the layers editor, you can create a new layer using the plus sign. You can change the names of the layers and also toggle their visibility and add effects.

During the game, a virtual camera is attached to each layer. You can move the camera in the scene, moving the part of the layer that is rendered on the screen. You can also rotate the camera, effectively rotating objects of this layer on the screen.

Centering the camera on an object

There are two actions to position the camera on an object:

  • If you want an object to always stay in the view of the camera, you can center the camera on an object. This will make the camera follow the object wherever it goes on the scene.
  • To prevent the camera from going out of bounds, you can center the camera on an object within limits. This will limit the center of the camera within the quadrilateral inscribed using the two diagonally opposite points entered.

Zooming with camera

Camera can have a zoom applied to them. If you zoom into a scene, the contents appear larger and if you zoom out, they appear smaller than the default setting. The default zoom value is 1. To zoom in, set a value higher than 1 and to zoom out, set a value less than 1.

Changing visibility of a layer

Visibility of a layer can be toggled, either in the Layers Editor or using events. Hiding a layer does not delete the objects on the layer. If a layer is hidden, all the objects on the layer exist and can interact with the objects on other layers but they are not visible.

By default, all layers are visible. This can be changed in the Layers Editor.

Changing the time scale of a layer

The “time scale” of a layer allows you to change the speed of all the animations in a layer, as well as all object movements. To slow down the time on a layer, set a time scale less than 1. To speed up the time on a layer, set a time scale greater than 1. The default time scale is 1 for all layers.

Effects (shaders) on layers

In a future version of GDevelop, layers will be able to get effects applied on them. Vote for this feature on the roadmap: https://trello.com/c/3tjeWGuc/94-add-support-for-choosing-the-effects-to-apply-on-layers-in-gdevelop-5

Other manipulations on layers and cameras

Changing object layers during the game

You can move the object to a different layer or check the layer of the object using actions and conditions that are available for all objects.

Dimensions and angle of the camera

  • Height of the camera is the length of the vertical side of the game visible and width is the length of the horizontal side. By default, these sizes are the same as the game window. If you change them, the rendering of the layer will be stretched or minimised. Most of the time, if you change the size of the game window, you'll want to change or restart the scene so that the camera update their size to the new window size.
  • The camera angle is the angle by which the camera is rotated on the X-Y plane. The angle increases as we go in the clockwise direction.