Constants, balance, staying on level after death

This commit is contained in:
Nikita Iryupin 2021-06-05 18:07:51 +02:00
parent b807825832
commit ac87e817b8
8 changed files with 11 additions and 8 deletions

View File

@ -15,7 +15,7 @@
"X Bf X Bf X B8 Bc B4 X Bf X Bf X ", "X Bf X Bf X B8 Bc B4 X Bf X Bf X ",
"X X X X X Ba Ef B5 X X X X X " "X X X X X Ba Ef B5 X X X X X "
], ],
"bots": 1, "bots": 10,
"size": { "size": {
"width": 13, "width": 13,
"height": 13 "height": 13

View File

@ -15,7 +15,7 @@
"X BF X X X B8 BC B4 X BF X BF X ", "X BF X X X B8 BC B4 X BF X BF X ",
"X BF X BF X BA Ef B5 X BF BF BF X " "X BF X BF X BA Ef B5 X BF BF BF X "
], ],
"bots": 1, "bots": 10,
"size": { "size": {
"width": 13, "width": 13,
"height": 13 "height": 13

View File

@ -15,7 +15,7 @@
"BF BF X T5 X B8 BC B4 X Ff Ff Ff X ", "BF BF X T5 X B8 BC B4 X Ff Ff Ff X ",
"TF BF BF X X BA Ef B5 X BF X X X " "TF BF BF X X BA Ef B5 X BF X X X "
], ],
"bots": 20, "bots": 10,
"size": { "size": {
"width": 13, "width": 13,
"height": 13 "height": 13

View File

@ -15,7 +15,7 @@
"Ff X B3 B3 X B8 Bc B4 B3 B3 X Ff Ff ", "Ff X B3 B3 X B8 Bc B4 B3 B3 X Ff Ff ",
"Tf Ff X X X Ba Ef B5 X X Ff Ff Tf " "Tf Ff X X X Ba Ef B5 X X Ff Ff Tf "
], ],
"bots": 20, "bots": 10,
"size": { "size": {
"width": 13, "width": 13,
"height": 13 "height": 13

View File

@ -87,6 +87,5 @@ export class Box {
this._hBox = this._hBox - (this._hOriginBox / 2); this._hBox = this._hBox - (this._hOriginBox / 2);
break; break;
} }
console.log(this._hBox + " " + this._wBox);
} }
} }

View File

@ -129,7 +129,7 @@ export class GameField {
setTimeout(() => { setTimeout(() => {
cancelAnimationFrame(this.lastRequest); cancelAnimationFrame(this.lastRequest);
this.lastRequest = undefined; this.lastRequest = undefined;
this.play(1, false); this.play(Constants.STAY_ON_LEVEL_AFTER_DEATH.getValue() ? this.map.mapLevel : 0, false);
}, 2000); }, 2000);
} }

View File

@ -9,7 +9,7 @@ export class AITankManager {
* @param {CollisionManager} collisionManager * @param {CollisionManager} collisionManager
*/ */
constructor(collisionManager) { constructor(collisionManager) {
this.MAX_TANKS_ON_FIELD = 2; this.maxTanks = Constants.MAX_ACTIVE_TANKS_ON_LEVEL.getValue();
this._count = null; this._count = null;
this._collision = collisionManager; this._collision = collisionManager;
@ -38,7 +38,7 @@ export class AITankManager {
this._collision.addNewAITank(tank); this._collision.addNewAITank(tank);
} }
if (this._activeTanks.length >= this.MAX_TANKS_ON_FIELD) if (this._activeTanks.length >= this.maxTanks)
this._canSpawn = false; this._canSpawn = false;
} }

View File

@ -6,6 +6,10 @@ export class Constants {
static TANK_DEFAULT_SPAWN_X = new Constants(4*this.TILE_SIZE.getValue()); static TANK_DEFAULT_SPAWN_X = new Constants(4*this.TILE_SIZE.getValue());
static TANK_DEFAULT_SPAWN_Y = new Constants(12*this.TILE_SIZE.getValue()); static TANK_DEFAULT_SPAWN_Y = new Constants(12*this.TILE_SIZE.getValue());
static MAX_ACTIVE_TANKS_ON_LEVEL = new Constants(3);
static STAY_ON_LEVEL_AFTER_DEATH = new Constants(true);
static SHOT_SPEED = new Constants(2.0); static SHOT_SPEED = new Constants(2.0);
static SHOT_SIZE = new Constants(5); static SHOT_SIZE = new Constants(5);