Sha256: c16a54e53356e772ebcff3c307c1211ead8ad59e90beb1729538da21720903e1

Contents?: true

Size: 762 Bytes

Versions: 8

Compression:

Stored size: 762 Bytes

Contents

/*
The sheet component converts a each frame of a sprite sheet into their own components.
*/
re.sheet = function(map, components, sizeX, sizeY){
        
    var frameWidth = sizeX || re.tile.sizeX;
    var frameHeight = sizeY || re.tile.sizeY;
    
    if(re.is(components,'array')){
      components = components.join(' ');
    }
        
    //create new sprites for sheet
        
    //save frame positions from map
    var x;
    var y;
    var b = [];
    for(var p in map){
        x = map[p][0] || 0;
        y = map[p][1] || 0;
        b.push(p);
        re.c(p)
        .requires('sprite '+components)
        .defines({
      frameX:x,
      frameY:y,
      sizeX:frameWidth,
      sizeY:frameHeight
        });
            
    }
  
    return b;
};

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
entityjs-0.4.4 src/util/sheet.js
entityjs-0.4.3 src/util/sheet.js
entityjs-0.4.2 src/util/sheet.js
entityjs-0.4.1 src/util/sheet.js
entityjs-0.4.0 src/util/sheet.js
entityjs-0.3.2 src/util/sheet.js
entityjs-0.3.1 src/util/sheet.js
entityjs-0.3.0 src/util/sheet.js