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
+5 -2
View File
@@ -36,16 +36,19 @@ HTMLActuator.prototype.addTile = function (tile) {
this.tileContainer.appendChild(element);
if (tile.previousPosition) {
window.requestAnimationFrame(function () {
element.classList.remove(element.classList[2]);
element.classList.add(self.positionClass({ x: tile.x, y: tile.y }));
});
} else if (tile.mergedFrom) {
element.classList.add("tile-merged");
tile.mergedFrom.forEach(function (merged) {
self.addTile(merged);
});
} else {
element.classList.add("tile-new");
}
};
HTMLActuator.prototype.normalizePosition = function (position) {