Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Key-binding 'Spacebar' to pause
  • Loading branch information
AlexWayfer committed Apr 19, 2014
1 parent d097919 commit 623bc14
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion index.html
Expand Up @@ -25,7 +25,7 @@
<div class="heading">
<h1 class="title">2048-Tetris</h1>
<div class="scores-container">
<div class="pause-container" onclick="pause();" id = "Pause">||</div>
<div class="pause-container" onclick="pause();" id = "Pause" title="Spacebar">||</div>
<div class="score-container">0</div>
<div class="best-container">0</div>
</div>
Expand Down Expand Up @@ -139,9 +139,11 @@ <h1 class="title">2048-Tetris</h1>
if(elem.innerHTML == "||") {
window.clearTimeout(window.autoFall);
elem.innerHTML = "&#9658;";
elem.setAttribute('class','pause-container paused');
} else {
window.autoFall = setTimeout(function(){window.moveObj.move(4);}, window.timeOut);
elem.innerHTML = "||";
elem.setAttribute('class','pause-container');
}
}

Expand Down
3 changes: 1 addition & 2 deletions js/keyboard_input_manager.js
Expand Up @@ -64,8 +64,7 @@ KeyboardInputManager.prototype.listen = function () {
self.emit("move", mapped);
}

if (event.which === 32) self.restart.bind(self)(event);
if (event.which === 80) pause();
if (event.which === 32) { event.preventDefault(); pause(); }
}
}

Expand Down
5 changes: 4 additions & 1 deletion style/main.css
Expand Up @@ -103,7 +103,10 @@ h1.title {
content: "Next Tile"; }

.pause-container:after {
content: "|| \25BA"; }
content: "PAUSE"; }

.pause-container.paused:after {
content: "PLAY"; }

.pause-container {
background-color: #E6B978;
Expand Down

0 comments on commit 623bc14

Please sign in to comment.