Skip to content

Commit d2e3fc1

Browse files
committed
fixed paused functionality and made it so cannot pause the game before it has started so player cannot get extra time
1 parent 076718a commit d2e3fc1

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

readme.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,3 @@
4747
- Help page
4848
- Feedback button
4949
- Include license
50-
- Pause, and pause game while in menu

tetris.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,15 +489,15 @@ function unpause() {
489489
pauseTime += (Date.now() - startPauseTime);
490490
msg.innerHTML = '';
491491
menu();
492-
//restart timer
493-
//actually unpasue the paused game eh
494492
}
495493

496494
function pause() {
495+
if (gameState != 3) {
497496
paused = !paused;
498497
startPauseTime = Date.now();
499498
msg.innerHTML = "Paused";
500-
menu(4);
499+
menu(4);
500+
}
501501
}
502502

503503
/**
@@ -1246,9 +1246,7 @@ function update() {
12461246
menu(3);
12471247
}
12481248

1249-
if (!paused) {
12501249
statistics();
1251-
}
12521250

12531251
if (lastKeys !== keysDown) {
12541252
lastKeys = keysDown;
@@ -1267,7 +1265,7 @@ function gameLoop() {
12671265
if (!paused) {
12681266
update();
12691267
}
1270-
1268+
12711269
if ((fallingPiece.x !== lastX ||
12721270
Math.floor(fallingPiece.y) !== lastY ||
12731271
fallingPiece.pos !== lastPos ||

0 commit comments

Comments
 (0)