[editor] update
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user