Layers and camera
Layers
A layer is a transparent sheet of the layout. Upper layers show over lower ones. The Layers panel lists the layout's layers (in the Platformer example: Background, Layer 0 and MobileControls).
What they are for:
- Background on a bottom layer.
- Interface (score, buttons) on a top layer that does not move with the camera.
- Hiding or locking a group of objects while you edit (the eye and padlock icons).
When you drag an object into the layout it goes onto the selected layer. You can change an instance's layer in its properties panel.
Camera
Each layer has its own camera. By default it shows the layout's starting area, standing still.
Make the camera follow the player
No events needed: add the Platformer smooth camera (or Smooth camera) behavior to the player. The camera follows the object smoothly, as in the Platformer example.
With events, use the Center the camera on an object action:
| Conditions | Actions |
|---|---|
| (none) | Player Center the camera on an object |
Interface that does not move with the camera
Because each layer's camera is independent, objects on the interface layer stay put on screen even when the game layer's camera moves.
Order within a layer
An instance's Z order decides who shows in front within the same layer. Higher is in front.
Tip: in events, when you create an object, choose the layer it appears on. A shot created on the wrong layer can end up hidden behind the background.