Code edit (1 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'withOffset is not defined' in or related to this line: 'levelText.x = centerX + (withOffset ? 2048 : 0);' Line Number: 230
Code edit (3 edits merged)
Please save this source code
User prompt
when background animate Transition ends, restore initial positions of graphics
Code edit (1 edits merged)
Please save this source code
User prompt
when changing level, call animateTransition on backgroundImage
User prompt
in BackgroundImage add a new function animateTransition() that animates the move of the 4 graphics with a delta of -2048 for x and -2732 for y
Code edit (8 edits merged)
Please save this source code
User prompt
create a class for levelNumberText and use it
Code edit (13 edits merged)
Please save this source code
User prompt
update levelNumberText when changing level
Code edit (1 edits merged)
Please save this source code
User prompt
add a new levelNumberText Text: - declare levelNumberText global - initialize it in initializeGame function, very big and at the screen center. set its text to the current Level number. not visible. - make it visible in initNewRoundState
Code edit (1 edits merged)
Please save this source code
User prompt
play operationSelect when dragNode is set to operation
Code edit (5 edits merged)
Please save this source code
User prompt
rename tileEntrance to tileRemove
Code edit (4 edits merged)
Please save this source code
User prompt
play tile entrance sound once when a tile enters the screen
User prompt
play tick sound once when a tile is highlighted
Code edit (5 edits merged)
Please save this source code
User prompt
rework the lines : ``` // Place tiles randomly out of the screen tile.x = Math.random() * 2300 - 1024; tile.y = Math.random() * 3000 - 1366; ``` To ensure tiles always start out of the screen
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -40,8 +40,11 @@
x: centerX + 2048,
y: centerY + 2732
});
self.animateTransition = function () {
+ if (puzzleManager.currentLevel == 1) {
+ return;
+ }
tween(backgroundGraphics, {
x: backgroundGraphics.x - 2048,
y: backgroundGraphics.y - 2732
}, {
@@ -199,8 +202,9 @@
});
// LevelNumberText class to represent the level number text
var LevelNumberText = Container.expand(function (initialLevel) {
var self = Container.call(this);
+ self.displayedLevel = initialLevel;
// Initialize level number text
var levelText = new Text2(initialLevel.toString(), {
size: 600,
fill: 0x787878,
@@ -233,10 +237,13 @@
levelText2.visible = false;
self.addChild(levelText2);
// Method to update the level number
self.updateLevel = function (newLevel) {
- //levelText.setText(newLevel.toString());
if (newLevel > 1) {
+ if (newLevel == self.displayedLevel) {
+ // When reseting current level show current level in text2
+ levelText2.setText(self.displayedLevel.toString());
+ }
tween(levelText, {
x: levelText.x - 2048,
y: levelText.y - 2732
}, {
@@ -249,8 +256,11 @@
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
+ self.displayedLevel = newLevel;
+ levelText.setText(newLevel.toString());
+ levelText2.setText((newLevel + 1).toString());
// Restore initial positions
levelText.x += 2048;
levelText.y += 2732;
levelText2.x += 2048;
@@ -261,36 +271,15 @@
};
// Method to show the level number
self.show = function () {
levelText.visible = true;
+ levelText2.visible = true;
};
// Method to hide the level number
self.hide = function () {
levelText.visible = false;
+ levelText2.visible = false;
};
- self.animateTransition = function () {
- tween(levelText, {
- x: levelText.x - 2048,
- y: levelText.y - 2732
- }, {
- duration: 1000,
- easing: tween.easeInOut
- });
- tween(levelText2, {
- x: levelText2.x - 2048,
- y: levelText2.y - 2732
- }, {
- duration: 1000,
- easing: tween.easeInOut,
- onFinish: function onFinish() {
- // Restore initial positions
- levelText.x += 2048;
- levelText.y += 2732;
- levelText2.x += 2048;
- levelText2.y += 2732;
- }
- });
- };
return self;
});
// OperationButton class to represent each operation button
var OperationButton = Container.expand(function (type, uses) {
@@ -360,8 +349,9 @@
tint: 0xEAEEE8
});
self.down = function () {
self.disable();
+ LK.getSound("resetSound").play();
puzzleManager.reset(); // Reset the level puzzle
};
self.disable = function () {
buttonGraphics.alpha = 0.5; // Dim the button to indicate it's disabled
@@ -448,9 +438,9 @@
backgroundImage.animateTransition();
self.createBoard();
self.fillTilesNeighbors();
self.createOperations();
- self.animateTilesEntrance();
+ LK.setTimeout(self.animateTilesEntrance, levelNumber == 1 ? 0 : 1000);
};
self.createBoard = function () {
self.board = [];
var maxTilesInRow = 0; // Local variable to track the largest number of tiles in the level rows
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