add tile merging

This commit is contained in:
Gabriele Cirulli
2014-03-09 20:03:04 +01:00
parent efa2af59a2
commit 53e08722e0
7 changed files with 157 additions and 58 deletions
+6
View File
@@ -4,8 +4,14 @@ function Tile(position, value) {
this.value = value || 2;
this.previousPosition = null;
this.mergedFrom = null; // Tracks tiles that merged together
}
Tile.prototype.savePosition = function () {
this.previousPosition = { x: this.x, y: this.y };
};
Tile.prototype.updatePosition = function (position) {
this.x = position.x;
this.y = position.y;
};