Skip to content

Commit b080e53

Browse files
add small code tweaks
1 parent 39ebf51 commit b080e53

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

‎js/game_manager.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,6 @@ GameManager.prototype.tileMatchesAvailable = function () {
211211
var cell = { x: x + vector.x, y: y + vector.y };
212212

213213
var other = self.grid.cellContent(cell);
214-
if (other) {
215-
}
216214

217215
if (other && other.value === tile.value) {
218216
return true; // These two tiles can be merged

‎js/html_actuator.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function HTMLActuator() {
22
this.tileContainer = document.querySelector(".tile-container");
33
this.scoreContainer = document.querySelector(".score-container");
4-
this.bestContainer = document.querySelector(".best-container");
4+
this.bestContainer = document.querySelector(".best-container");
55
this.messageContainer = document.querySelector(".game-message");
66

77
this.score = 0;

‎js/keyboard_input_manager.js‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,22 @@ KeyboardInputManager.prototype.listen = function () {
5959
// Listen to swipe events
6060
var touchStartClientX, touchStartClientY;
6161
var gameContainer = document.getElementsByClassName("game-container")[0];
62-
gameContainer.addEventListener("touchstart", function(event) {
62+
63+
gameContainer.addEventListener("touchstart", function (event) {
6364
if (event.touches.length > 1) return;
6465

6566
touchStartClientX = event.touches[0].clientX;
6667
touchStartClientY = event.touches[0].clientY;
6768
event.preventDefault();
6869
});
69-
gameContainer.addEventListener("touchmove", function(event) {
70+
71+
gameContainer.addEventListener("touchmove", function (event) {
7072
event.preventDefault();
7173
});
72-
gameContainer.addEventListener("touchend", function(event) {
73-
if (event.touches.length > 0) {
74-
return;
75-
}
74+
75+
gameContainer.addEventListener("touchend", function (event) {
76+
if (event.touches.length > 0) return;
77+
7678
var dx = event.changedTouches[0].clientX - touchStartClientX;
7779
var absDx = Math.abs(dx);
7880

‎js/local_score_manager.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
window.fakeStorage = {
22
_data : {},
33
setItem : function (id, val) {
4-
console.log('set');
4+
console.log("set");
55
return this._data[id] = String(val);
66
},
77
getItem : function (id) {
@@ -13,8 +13,9 @@ window.fakeStorage = {
1313

1414
function LocalScoreManager() {
1515
var localSupported = !!window.localStorage;
16-
this.key = 'bestScore';
17-
this.storage = localSupported ? window.localStorage : window.fakeStorage;
16+
17+
this.key = "bestScore";
18+
this.storage = localSupported ? window.localStorage : window.fakeStorage;
1819
}
1920

2021
LocalScoreManager.prototype.get = function () {

0 commit comments

Comments
 (0)