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

View File

@@ -6,9 +6,8 @@ class Player {
this.pos = {x: 0, y: 0};
this.matrix = null;
this.score = 0;
this.isHolding = false;
this.holdingTile = null;
this.level = 1;
this.lastLevelScore = 0;
this.a.p = this;
}
@@ -29,19 +28,6 @@ class Player {
this.g.dropCounter = 0;
}
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();
}
move(dir) {
this.pos.x += dir;
if (collide(this.a.field, this)) {
@@ -83,4 +69,4 @@ class Player {
}
}
}
}
}