IgeEntity

Method: dimensionsFromCell

Sets the geometry of the entity to match the width and height of the assigned texture cell. If the texture is not cell-based the entire texture width / height will be used.
dimensionsFromCell (Number percent)
  • Numberpercent The percentage size to resize to.
Returns * The object this method was called from to allow method chaining

Set the entity dimensions based on the assigned texture and cell

var texture = new IgeSpriteSheet('path/to/some/cellSheet.png', [
    [0, 0, 40, 40, 'robotHead'],
    [40, 0, 40, 40, 'humanHead'],
]);
// Assign the texture, set the cell to use and then
// set the entity to the size of the cell automatically!
entity.texture(texture)
    .cellById('robotHead')
    .dimensionsFromCell();
© 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