项目文件夹

文件
frostbyte_neo 9ccbe096fe feat: add a deployable 2048 static game for WeHub Cloud
Vendors gabrielecirulli/2048 (MIT) under frontend/dist so Cloud can scan it as a static_site.

Co-Authored-By: Cursor Grok 4.6 <cursoragent@cursor.com>
2026-09-11 16:57:55 +08:00

28 行
594 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;
};
Tile.prototype.serialize = function () {
return {
position: {
x: this.x,
y: this.y
},
value: this.value
};
};