===================================================================
--- original.js
+++ change.js
@@ -4,9 +4,9 @@
//<Assets used in the game will automatically appear here>
// Tile class to represent each tile in the game
var Tile = Container.expand(function () {
var self = Container.call(this);
- self.value = 2; // Initial value of the tile
+ self.value = 0; // Initial value of the tile
self.graphics = self.attachAsset('tile', {
anchorX: 0.5,
anchorY: 0.5
});
@@ -19,13 +19,9 @@
self.addChild(self.text);
self.updateValue = function (newValue) {
self.value = newValue;
self.text.setText(self.value.toString());
- self.graphics.setText(self.value.toString(), {
- fontSize: 50,
- fill: "#ffffff",
- align: "center"
- });
+ // Removed incorrect setText call on graphics object
};
});
/****
@@ -64,9 +60,9 @@
function addNewTile() {
var emptyTiles = [];
for (var i = 0; i < gridSize; i++) {
for (var j = 0; j < gridSize; j++) {
- if (grid[i][j].value === 2) {
+ if (grid[i][j].value === 0) {
emptyTiles.push(grid[i][j]);
}
}
}