Add default spawn of tank
This commit is contained in:
parent
dad4703ee0
commit
4aa6289f50
@ -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": 20,
|
"bots": 1,
|
||||||
"size": {
|
"size": {
|
||||||
"width": 13,
|
"width": 13,
|
||||||
"height": 13
|
"height": 13
|
||||||
|
|||||||
@ -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": 20,
|
"bots": 1,
|
||||||
"size": {
|
"size": {
|
||||||
"width": 13,
|
"width": 13,
|
||||||
"height": 13
|
"height": 13
|
||||||
|
|||||||
@ -88,6 +88,9 @@ export class GameField {
|
|||||||
|
|
||||||
async play(level) {
|
async play(level) {
|
||||||
this.ctx.clearRect(0,0, this.width, this.height);
|
this.ctx.clearRect(0,0, this.width, this.height);
|
||||||
|
this.tank.x = Constants.TANK_DEFAULT_SPAWN_X.getValue();
|
||||||
|
this.tank.y = Constants.TANK_DEFAULT_SPAWN_Y.getValue();
|
||||||
|
this.aiTanks = new AITankManager(this.collisionManager);
|
||||||
if (!this.tileset || !this.map || this.map.mapLevel != level) {
|
if (!this.tileset || !this.map || this.map.mapLevel != level) {
|
||||||
$(".loading").show();
|
$(".loading").show();
|
||||||
$(".text-loading").show();
|
$(".text-loading").show();
|
||||||
@ -108,13 +111,11 @@ export class GameField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lose() {
|
lose() {
|
||||||
|
|
||||||
this.soundManager.playSound(SoundEnum.GameOver);
|
this.soundManager.playSound(SoundEnum.GameOver);
|
||||||
requestAnimationFrame(() => this.drawFieldRecursive())
|
requestAnimationFrame(() => this.drawFieldRecursive())
|
||||||
}
|
}
|
||||||
|
|
||||||
win() {
|
win() {
|
||||||
|
|
||||||
this.play(this.map.mapLevel + 1);
|
this.play(this.map.mapLevel + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,9 @@ export class Constants {
|
|||||||
static TANK_SIZE = new Constants(24);
|
static TANK_SIZE = new Constants(24);
|
||||||
static TANK_COLL_OFFSET = new Constants(0.05);
|
static TANK_COLL_OFFSET = new Constants(0.05);
|
||||||
static TANK_SPEED = new Constants(2.0);
|
static TANK_SPEED = new Constants(2.0);
|
||||||
|
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 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);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user