Method: layer

Gets / sets the current entity layer. This affects how the entity is depth-sorted against other entities of the same parent. Please note that entities are first sorted by their layer and then by their depth, and only entities of the same layer will be sorted against each other by their depth values.
layer (Number val)
  • Numberval
Returns * Returns this when setting the value or the current value if none is specified.

Set an entity's layer to 22

var entity = new IgeEntity()

Get an entity's layer value

var entity = new IgeEntity()

How layers and depths are handled together

var entity1 = new IgeEntity(),
    entity2 = new IgeEntity(),
    entity3 = new IgeEntity();

// Set entity1 to at layer zero and depth 100

// Set entity2 and 3 to be at layer 1

// Set entity3 to have a higher depth than entity2

// The engine sorts first based on layer from lowest to highest
// and then within each layer, by depth from lowest to highest.
// This means that entity1 will be drawn before entity 2 and 3
// because even though it's depth is higher, it is not on the same
// layer as entity 2 and 3.

// Based on the layers and depths we have assigned, here
// is how the engine will sort the draw order of the entities
// entity1
// entity2
// entity3
© Copyright 2013 Irrelon Software Limited. All Rights Reserved. UK Registered Company Number: 07522767
Isogenic (ī´sōjen´ik): Adj originating from a common source; possessing the same genetic composition.
Strange Things Happen at the One Two Point