Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mamayaya1
GitHub Repository: mamayaya1/game
Path: blob/main/projects/1/js/tile.js
4626 views
1
function Tile(position, value) {
2
this.x = position.x;
3
this.y = position.y;
4
this.value = value || 2;
5
6
this.previousPosition = null;
7
this.mergedFrom = null; // Tracks tiles that merged together
8
}
9
10
Tile.prototype.savePosition = function () {
11
this.previousPosition = { x: this.x, y: this.y };
12
};
13
14
Tile.prototype.updatePosition = function (position) {
15
this.x = position.x;
16
this.y = position.y;
17
};
18
19