Code edit (16 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: resetButton.hide is not a function' in or related to this line: 'resetButton.hide();' Line Number: 1419
Code edit (1 edits merged)
Please save this source code
Code edit (18 edits merged)
Please save this source code
User prompt
add a new MenuButton class and a menuButton global similar to ResetButon and resetButton
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'levelText is not defined' in or related to this line: 'menuCell.addChild(levelText);' Line Number: 398
Code edit (1 edits merged)
Please save this source code
User prompt
add a new class MenuBoard that contains a grid of assets named menuGrid. (use a new asset named menuCell)
Code edit (3 edits merged)
Please save this source code
User prompt
in StartButton fadeOut, apply the same animation as for tile setValue to 0 to each letterGraphics
User prompt
in StartButton, use a container for each letter, add tileGraphics and letterText as children of this container then add the container to self.letterGraphics
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
in StartButton, add 5 new texts similars to startText for each letter of the word "START"
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: levelText is not defined' in or related to this line: 'levelText.setText("?");' Line Number: 1149
Code edit (21 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: levelText is not defined' in or related to this line: 'levelText.setText("?");' Line Number: 1145
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (11 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: Error: Invalid color format. Expected 0xRRGGBB format, received: undefined' in or related to this line: 'tween(tileGraphics, {' Line Number: 235
===================================================================
--- original.js
+++ change.js
@@ -407,80 +407,49 @@
// Asset Attachments
var buttonShadow = self.attachAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
- x: 10,
- y: 10,
+ x: 8,
+ y: 8,
+ scaleX: 1.0,
+ scaleY: 1.0,
tint: 0x000000,
alpha: 0.25
});
var buttonGraphics = self.attachAsset('menuButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
- tint: 0xEAEEE8
+ tint: 0x787878,
+ blendMode: 1
});
self.down = function () {
- self.disable();
tween(self, {
- rotation: Math.PI * 2 // Rotate 360 degrees
+ scaleY: 0
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
- self.rotation = 0; // Restore rotation to 0
+ changeGameState(GAME_STATE.MENU);
+ tween(self, {
+ scaleY: 1
+ }, {
+ duration: 500,
+ easing: tween.easeOut
+ });
}
});
LK.getSound("resetSound").play();
- // Add functionality for menu button
};
- self.disable = function () {
- buttonGraphics.alpha = 0.5; // Dim the button to indicate it's disabled
- self.interactive = false; // Disable interaction
- tween(self, {
- scaleX: 0.8,
- scaleY: 0.8
- }, {
- duration: 300,
- easing: tween.easeOut
- });
- };
- self.enable = function () {
- buttonGraphics.alpha = 1.0; // Restore full opacity to indicate it's enabled
- self.interactive = true; // Enable interaction
- tween(self, {
- scaleX: 1.0,
- scaleY: 1.0
- }, {
- duration: 300,
- easing: tween.easeOut
- });
- };
+ self.disable = function () {};
+ self.enable = function () {};
self.activate = function () {
self.visible = true;
};
self.deactivate = function () {
self.visible = false;
};
- self.highlight = function () {
- tween(self, {
- scaleX: 1.2,
- scaleY: 1.2
- }, {
- duration: 300,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- tween(self, {
- scaleX: 1.0,
- scaleY: 1.0
- }, {
- duration: 300,
- easing: tween.easeOut
- });
- }
- });
- };
return self;
});
// OperationButton class to represent each operation button
var OperationButton = Container.expand(function (type, index) {
@@ -669,8 +638,11 @@
});
}
});
};
+ self.hide = function () {
+ self.visible = false;
+ };
return self;
});
// StartButton class to represent the start button
var StartButton = Container.expand(function () {
@@ -883,9 +855,9 @@
// Core Functions
self.initPuzzle = function () {
self.loadLevel(self.currentLevel);
};
- self.reset = function () {
+ self.reset = function (noContinue) {
// Remove all existing tiles
self.board.forEach(function (tile) {
// Animate tiles moving randomly out of screen
tween(tile, {
@@ -917,8 +889,11 @@
self.operations = [];
self.levelFailed = false;
// Load the current level
self.previousLevelNumber = self.currentLevel;
+ if (noContinue) {
+ return;
+ }
LK.setTimeout(function () {
self.loadLevel(self.currentLevel);
}, 850);
};
@@ -1368,28 +1343,27 @@
}
/***********************************************************************************************/
/************************************* GAME STATE MANAGEMENT ************************************/
/***********************************************************************************************/
-function initMenuState() {
- // Initialize the game state for MENU
- log("Initializing MENU State");
- if (debug) {
- //changeGameState(GAME_STATE.NEW_ROUND);
- }
-}
function cleanInitState() {
// Clean up the game state for MENU
log("Cleaning INIT State");
startButton.fadeOut();
}
+function initMenuState() {
+ // Initialize the game state for MENU
+ log("Initializing MENU State");
+ menuBoard.visible = true;
+}
function handleMenuLoop() {
// Handle the game loop for MENU state
log("Handling MENU Loop");
}
function cleanMenuState() {
// Clean up the game state for MENU
log("Cleaning MENU State");
// Remove menu buttons
+ menuBoard.visible = false;
}
function initNewRoundState() {
// Initialize the game state for NEW_ROUND
log("Initializing NEW_ROUND State");
@@ -1423,8 +1397,10 @@
function cleanPlayingState() {
// Clean up the game state for PLAYING
log("Cleaning PLAYING State");
resetButton.deactivate();
+ resetButton.hide();
+ puzzleManager.reset(true);
}
function initScoreState() {
// Initialize the game state for SCORE
log("Initializing SCORE State");
@@ -1550,9 +1526,8 @@
// Menu State Handlers
function handleMenuStateDown(x, y, obj) {
// Implement logic for handling down event in MENU state
log("Handling down event in MENU state");
- menuBoard.visible = false;
changeGameState(GAME_STATE.NEW_ROUND);
}
function handleMenuStateMove(x, y, obj) {
// Implement logic for handling move event in MENU state
tick
Sound effect
tileEntrance
Sound effect
tileRemove
Sound effect
operationSelect
Sound effect
operationCancel
Sound effect
tileChangeValue
Sound effect
resetSound
Sound effect
levelFailed
Sound effect
menuLevelSelect
Sound effect
menuCellEnter
Sound effect
applause
Sound effect
bgMusic
Music
tada
Sound effect