5.2.1. What is a Layer¶
Layers allow you to lay images on the scene with depth. Layers with a higher number appear in front of others.
When using layers, keep these concepts in mind:
- When we drag an image asset onto the scene it is automatically placed on layer 1
- The Default Entity layer is always updated
- The layer containing text is always updated
- Take care not to have more layers than is necessary
- Entities and images placed on non-existent layers will not be shown.
- Updating layers can be very demanding on our device, so only update when you need to
- -1 represents the front-most layer regardless of how many layers you have
- Entity physics are independent of layers. No matter what layer entities are on, They will collide with each other
5.2.2. Actimator’s Default Layer Settings¶
By default, Actimator has 5 layers(0-4). Layer 0 is the very back, Layer 4 is the front most layer unless we increase the number of layers. Layers remain transparent until something is drawn on them, these images are cleared each time a the layer is updated. On the layers that are automatically updated, the layer is cleared back to transparent 60 times per second. On manually updated layers, we can choose how often to update the layer.
5.2.3. Updating Layers Programmatically¶
A moving entity on the scene will leave a trail wherever it is drawn until the layer it’s contained in is updated.
When you need to update a layer, you can use the Update Layer command. You can type in the number of the layer, or you can even use the This Entity Layer Command.
If you wish to update all layers, use the Update All Layers Command. Updating layers takes up a lot of your device’s processing power, use this command with caution.
5.2.4. Changing Layer Settings¶
Your game may require more than the default number of layers. In the scene’s Property Explorer you can change the maximum number of layers. If you wish to have 4 layers for backgrounds(0-3), you can make layer 4 the default entity layer. If you then wanted 3 foreground layers(5-7), your total number of layers would be 8.