# Layers

Layers helps you organize the scene in the back to front axis, by example

> - background : a fixed draw of landscape
> - far : decorative trees and birds
> - middle : platforms
> - near : player, enemies, coins
> - HUD : Heads Up Display to show game stats like life, energy

You can think layers as (usually) transparent sheets where the children are drawn, and the scene as the stack of sheets

In non MVC design style some code related to nodes interaction tends to float at the layer holding the entities, providing higher functional units. By example, Menu is a Layer subclass that knows how to layout and animate items, read user input and do control flow.

Layers are the ones defining appearance and behavior, so most of your programming time will be spent coding Layer subclasses that do what you need.

The Layer is where you define event handlers. Events are propagated to layers (from front to back) until some layer catches the event and accepts it.

Even if any serious app will require you to define some Layer subclasses, cocos2d provides some useful specialized layers

> - MultiplexLayer, a group of layers where only one is seen at a time
> - ScrollingManager, ScrollableLayer; does the logic to limit scroll to viewable areas
> - RectMapLayer, HexMapLayer; displays a group of rectangular or hexagonal tiles
> - Menu, implements simple menus
> - ColorLayer, a solid color rectangle
> - InterpreterLayer, used by director to pop up an interactive console to peek and poke at the objects in our scene ( ctrl + I to toggle on-off)

To make loading of appropriate assets easier you may override the `init` method of your Layer subclass. This will be called when your Layer is created.

Since layers are subclass of CocosNode, they can be transformed manually or by using actions. See Actions, Transformations and Effects for more detail about actions.