1
0
mirror of https://github.com/danog/2048.git synced 2024-12-14 02:07:39 +01:00
2048/js/tile.js
2014-03-09 20:03:04 +01:00

18 lines
455 B
JavaScript

function Tile(position, value) {
this.x = position.x;
this.y = position.y;
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;
};