[editor] update

This commit is contained in:
2018-02-05 20:46:11 +03:00
parent b36fd77d74
commit feb5bafe72
9 changed files with 100 additions and 37 deletions

View File

@@ -29,6 +29,10 @@ class LevelBundle {
return bricks.map(function(brick:BrickConfig) return brick.type).join('');
}
public static function empty(config:Config):Array<BrickConfig> {
return [for (i in 0...config.map.gridWidth*config.map.gridHeight) config.bricks[1]];
}
public static function get(type:GameType, config:Config, level:Int):Array<BrickConfig> {
var data:String = Assets.getText('resources/${type}/levels/level${formatLevel(level)}.txt');
return loads(config, data);

View File

@@ -62,4 +62,10 @@ class LevelMap {
public function getBrick(cell:GridCell):Brick {
return bricksMap.get(cell.position);
}
public function getPointBrick(point:Point):Brick {
var cellX:Int = Math.floor(point.x / config.cellWidth);
var cellY:Int = Math.floor(point.y / config.cellHeight);
return bricks[cellX + cellY * config.gridWidth];
}
}