Scenes, layers and entities
How a game is structured, and why layer order decides what you can see.
7 min readScenes
A scene is one screen of your game: a level, a menu, a results screen. Only one runs at a time. Most kits ship with a play scene and a game-over scene, and the logic graph moves between them.
Each scene owns its own world size, camera settings and list of graphs. The world can be much larger than the visible screen — that is what makes a scrolling level possible.
Layers
Layers decide draw order. Each has a depth, and everything on it draws at that depth. The defaults are:
| Layer | Depth | For |
|---|---|---|
| Background | −100 | Skies, parallax, the Mode-7 or raycast view |
| Main | 0 | The game itself |
| Foreground | 100 | Things that pass in front of the player |
| UI | 1000 | Score, lives, banners |
Entities
An entity is anything in the scene. It has a position, a layer, optional physics, a list of tags and a list of behaviours.
- Tags group entities. Collisions, spawners and the
For Each node all work in terms of tags, not individual objects.
Tag every enemy
enemyand one rule covers all of them. - Behaviours are prewritten chunks of movement or reaction you attach without writing logic — a platformer controller, a patrol, a health bar. See the behaviour reference.