Major rework of basic game code - pre-work for multiplayer

Includes automatic generation of required HTML elements and better responsiveness
This commit is contained in:
Marcel
2019-07-18 11:49:06 +02:00
committed by KingOfDog
parent 544b988a9b
commit 06a2e582fd
14 changed files with 627 additions and 357 deletions

21
js/local-player.js Normal file
View File

@@ -0,0 +1,21 @@
class LocalPlayer extends Player {
constructor(gameInfo, game) {
super(gameInfo, game);
this.isHolding = false;
this.holdingTile = null;
}
hold() {
if (this.isHolding)
return;
if (this.holdingTile === null) {
this.holdingTile = this.matrix;
this.reset(true);
} else {
this.holdingTile = [this.matrix, this.matrix = this.holdingTile][0];
this.reset(true, false);
}
this.game.drawHolding();
}
}