add movement check, score addition
This commit is contained in:
+9
-1
@@ -103,11 +103,15 @@ GameManager.prototype.move = function (direction) {
|
||||
|
||||
// Update the score
|
||||
self.score += merged.value;
|
||||
|
||||
// Something's moved for sure
|
||||
} else {
|
||||
self.moveTile(tile, positions.farthest);
|
||||
}
|
||||
|
||||
moved = true;
|
||||
if (!self.positionsEqual(cell, tile)) {
|
||||
moved = true; // The tile moved from its original cell!
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -201,3 +205,7 @@ GameManager.prototype.tileMatchesAvailable = function () {
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
GameManager.prototype.positionsEqual = function (first, second) {
|
||||
return first.x === second.x && first.y === second.y;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user