[config] config.yaml

This commit is contained in:
2018-01-11 16:34:21 +03:00
parent 729798bc25
commit 21bf2f9ba1
12 changed files with 209 additions and 168 deletions

View File

@@ -19,13 +19,13 @@ interface IState<T> {
}
class BrickState implements IState<Brick> {
private var type:BrickType;
private var type:Int;
public function new() {}
public function update(object:Brick):Bool {
if (type != object.type) {
type = object.type;
if (type != object.config.type) {
type = object.config.type;
return true;
}
return false;
@@ -59,14 +59,6 @@ class EntityState implements IState<Entity> {
class Render extends SpriteView implements IRender {
private static var GROUND_BRICKS:Array<BrickType> = [
BrickType.BRICK, BrickType.ARMOR, BrickType.WATER, BrickType.ACE
];
private static var UP_BRICKS:Array<BrickType> = [
BrickType.BUSH
];
private var backgroundLayer:Sprite;
private var groundLayer:Sprite;
private var entryLayer:Sprite;
@@ -139,14 +131,14 @@ class Render extends SpriteView implements IRender {
upLayer.graphics.clear();
for (brick in game.map.bricks) {
var g:Graphics = null;
if (GROUND_BRICKS.indexOf(brick.type) > -1) {
if (brick.config.layer < 3) {
g = groundLayer.graphics;
} else if (UP_BRICKS.indexOf(brick.type) > -1) {
} else if (brick.config.layer >= 3) {
g = upLayer.graphics;
}
if (g != null) {
g.beginFill(0x00ff00);
g.beginBitmapFill(Assets.getBitmapData('resources/images/map/map_${brick.type}.png'));
g.beginBitmapFill(Assets.getBitmapData('resources/images/map/map_${brick.config.type}.png'));
g.drawRect(
brick.cellX * game.map.cellWidth,
brick.cellY * game.map.cellHeight,
@@ -172,7 +164,7 @@ class Render extends SpriteView implements IRender {
image = 'resources/images/tank/player/tank_p${tank.config.level}_${tank.index}-0.png';
} else if (Std.is(ent, Bullet)) {
var bullet:Bullet = cast ent;
image = 'resources/images/bullet/bullet_${bullet.config.type}.png';
image = 'resources/images/bullet/bullet_${bullet.config.piercing-1}.png';
} else {
image = 'ERROR'; // ToDo:
}