bug fixed
This commit is contained in:
@@ -187,8 +187,8 @@ button:disabled { opacity: 0.3; cursor: not-allowed; }
|
|||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 14px 20px;
|
padding: 14px 20px;
|
||||||
margin-top: 0px; /* plus bas */
|
margin-top: -250px; /* plus bas */
|
||||||
margin-left: -800px; /* vers la gauche */
|
margin-left: -600px; /* vers la gauche */
|
||||||
box-shadow: 0 0 20px rgba(0,255,231,0.05);
|
box-shadow: 0 0 20px rgba(0,255,231,0.05);
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class Tetris {
|
|||||||
this.isPaused = false;
|
this.isPaused = false;
|
||||||
this.grid = this._createGrid(10, 20);
|
this.grid = this._createGrid(10, 20);
|
||||||
this.score = 0;
|
this.score = 0;
|
||||||
|
this.count = 0;
|
||||||
this.timeToDown = this.initialTimeToDown;
|
this.timeToDown = this.initialTimeToDown;
|
||||||
this.storedPiece = null;
|
this.storedPiece = null;
|
||||||
this.canStore = true;
|
this.canStore = true;
|
||||||
@@ -98,7 +99,7 @@ class Tetris {
|
|||||||
this.lastTime = currentTime;
|
this.lastTime = currentTime;
|
||||||
this.accumulator += deltaTime;
|
this.accumulator += deltaTime;
|
||||||
|
|
||||||
while (this.accumulator >= this.timeToDown) {
|
while (this.isRunning && this.accumulator >= this.timeToDown) {
|
||||||
this._tick();
|
this._tick();
|
||||||
this.accumulator -= this.timeToDown;
|
this.accumulator -= this.timeToDown;
|
||||||
if (this.accumulator > this.timeToDown * 3) {
|
if (this.accumulator > this.timeToDown * 3) {
|
||||||
@@ -268,9 +269,9 @@ class Tetris {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_makeHarder() {
|
_makeHarder() {
|
||||||
if (this.count >= this.hardening){
|
if (this.count >= this.hardening) {
|
||||||
this.count = 0;
|
this.count = 0;
|
||||||
this.timeToDown -= this.decrementTTD;
|
this.timeToDown = Math.max(100, this.timeToDown - this.decrementTTD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user