User prompt
change fliptile routine so that it just flips the clicked tile rather than using shape data. Still retain the red highlight before it flips to green
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught ReferenceError: gridSize is not defined' in or related to this line: 'self.gridSize = gridSize;' Line Number: 181
User prompt
Fix Bug: 'Uncaught ReferenceError: gridSize is not defined' in or related to this line: 'self.color = gridX === gridSize - 1 && gridY === 0 ? 0x33d62a : 0xFFFFFF; // Set all cells to white apart from the cell Zbert is on in the bottom left corner, set this cell to green' Line Number: 181
User prompt
Fix Bug: 'Uncaught ReferenceError: i is not defined' in or related to this line: 'self.color = i === this.gridSize - 1 && j === 0 ? 0x33d62a : 0xFFFFFF; // Set all cells to white apart from the cell Zbert is on in the bottom left corner, set this cell to green' Line Number: 181
User prompt
When grid is initiated sett all cells to white apart from cell Zbert is on in bottom left corner. set this cell to green
Code edit (4 edits merged)
Please save this source code
User prompt
When grid is initiated set all tiles to white
Code edit (4 edits merged)
Please save this source code
User prompt
Attach asset Zbert1 to left hand bottom grid cell.
User prompt
Fix Bug: 'Uncaught ReferenceError: CountdownTimer is not defined' in or related to this line: 'var countdownTimer = game.addChild(new CountdownTimer());' Line Number: 296
User prompt
remove shapedisplay code
User prompt
Fix Bug: 'ReferenceError: shapeDisplayData is not defined' in or related to this line: 'var shapeData = shapeDisplayData;' Line Number: 39
User prompt
Fix Bug: 'Uncaught ReferenceError: ShapeDisplay is not defined' in or related to this line: 'game.shapeDisplay = new ShapeDisplay();' Line Number: 240
User prompt
Fix Bug: 'ReferenceError: shapeDisplay is not defined' in or related to this line: 'var shapeData = shapeDisplay.shape.shapeData;' Line Number: 39
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught ReferenceError: CountdownTimer is not defined' in or related to this line: 'var countdownTimer = game.addChild(new CountdownTimer());' Line Number: 296
Code edit (7 edits merged)
Please save this source code
User prompt
Remove countdown timeand next shape text
User prompt
Fix Bug: 'Uncaught TypeError: self.attachAsset is not a function' in this line: 'var tileGraphics = self.attachAsset('tile', {});' Line Number: 263
User prompt
Fix Bug: 'Uncaught TypeError: self.attachAsset is not a function' in this line: 'var tileGraphics = self.attachAsset('tile', {});' Line Number: 262
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'flipColor')' in this line: 'tile.flipColor();' Line Number: 55
Code edit (5 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'color')' in this line: 'if (tileArray[i][j].color === 0xFFFFFF) {' Line Number: 68
===================================================================
--- original.js
+++ change.js
@@ -35,9 +35,9 @@
};
// Function to flip the color of a tile and its neighbors
self.flipTiles = function (x, y) {
// Get the current shape data from the ShapeDisplay
- var shapeData = shapeDisplay.shape.shapeData;
+ var shapeData = shapeDisplayData;
// Loop through the shape data, highlight tiles that will flip in red, and flip them after a delay
for (var i = 0; i < shapeData.length; i++) {
for (var j = 0; j < shapeData[i].length; j++) {
if (shapeData[i][j] === 1) {
@@ -127,40 +127,8 @@
return cell === 1;
}) ? 0x3636f7 : 0xFFFFFF;
// Removed the direct addition of shapeGraphics as a child since it's an array of assets, not a single asset
});
-var ShapeDisplay = Container.expand(function () {
- var self = Container.call(this);
- this.shape = null;
- // Create a background for the ShapeDisplay
- var shapeDisplayBackground = self.attachAsset('shapeDisplayBackground', {});
- shapeDisplayBackground.width = 2048;
- shapeDisplayBackground.height = 2732;
- shapeDisplayBackground.tint = 0xffffff;
- shapeDisplayBackground.alpha = 0.4;
- self.addChildAt(shapeDisplayBackground, 0);
- // Function to set the shape to be displayed
- self.setShape = function (shape) {
- this.shape = shape;
- this.addChild(shape);
- shape.x = 950; // Center the shape in the display area
- shape.y = 2732 - shape.height - 200; // Position the shape at the bottom of the screen
- shapeDisplayBackground.width = shape.width + 1800;
- shapeDisplayBackground.height = 600;
- // Center ShapeDisplay background on the middle of ShapeDisplay
- shapeDisplayBackground.x = shape.x + shape.width / 2 - shapeDisplayBackground.width / 2 - 50;
- shapeDisplayBackground.y = 2100;
- };
- // Function to update the displayed shape
- self.updateShape = function () {
- var randomIndex = Math.floor(Math.random() * shapes.length);
- var newShape = shapes[randomIndex];
- if (this.shape) {
- this.removeChild(this.shape);
- }
- this.setShape(newShape);
- };
-});
var Tile = Container.expand(function (gridX, gridY, width, height) {
var self = Container.call(this);
self.color = Math.random() < 0.5 ? 0xFFFFFF : 0x33d62a; // Randomly set the tile color to white or green
var tileGraphics = self.attachAsset('tile', {
@@ -183,9 +151,9 @@
tileGraphics.tint = self.color;
};
// Add event listener to flip tiles on touch
self.on('down', function () {
- game.grid.flipTiles(gridX, gridY);
+ game.grid.flipTiles(gridX, gridY, game.shapeDisplay);
if (game.grid.checkWinCondition()) {
game.showWin();
}
});
@@ -215,10 +183,10 @@
var TileCounter = Container.expand(function (color) {
var self = Container.call(this);
this.color = color;
var tileGraphics = self.attachAsset('tile', {});
- tileGraphics.width = 500;
- tileGraphics.height = 600;
+ tileGraphics.width = 300;
+ tileGraphics.height = 400;
tileGraphics.tint = this.color;
this.countText = new Text2('0', {
size: 230,
weight: 800,
@@ -267,8 +235,10 @@
// Set an initial background
setBackgroundByNumber(2);
// Initialize the TileColorCounter and add it to the game
initializeTileColorCounter();
+// Initialize the shapeDisplay and store it in the game object
+game.shapeDisplay = new ShapeDisplay();
// Add the grid to the game
game.grid = game.addChild(new Grid());
game.grid.initGrid();
var tileWidth = 150;
@@ -288,11 +258,8 @@
} else {
LK.showGameOver(); // Show game over screen when max size is reached
}
};
-// Initialize the ShapeDisplay and display a randomly selected shape
-var shapeDisplay = game.addChild(new ShapeDisplay());
-shapeDisplay.updateShape();
// Initialize the TileColorCounter and add it to the game
var tileColorCounter;
function initializeTileColorCounter() {
tileColorCounter = game.addChild(new TileColorCounter());
beautiful landscape. starry sky, pastel colours, high definition, alien world. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
beautiful landscape. starry sky, pastel colours, high definition, alien world.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
beautiful expansive landscape. starry sky, pastel colours, high definition, alien world.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
beautiful expansive landscape. starry sky, pastel colours, high definition, alien world.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A little cube person. 2 legs. back to viewer. facing 45 degrees to the right. multicoloured skin, cartoon style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
white circle. metallic. light bevel on edge. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Round furry, cute alien ball with big eyes. vivid colours, looking at 45 degrees to the right. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
bright 3d present with bow, vivd colours. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Change to be vivid multicoloured cube
A simple Triangle, flat shaded, bevelled edges. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Speech bubble with expletive word in it. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
parachute. multicoloured. cartoon style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
white circle with a single thin black border. flat shade. simple graphic. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
small star shape, vivid metallic blue, varying length spikes on star. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.