Code edit (5 edits merged)
Please save this source code
User prompt
limit dragNode rotation between -0.1 and 0.1 and restore it to zero if deltaX is low
User prompt
during handlePlayingStateMove, Animate dragNode's rotation slightly depending on x delta
Code edit (1 edits merged)
Please save this source code
User prompt
``` tween(self.valueText, { scaleX: scaleRatio, scaleY: scaleRatio }, { duration: 500, easing: tween.easeOut }); ``` for self.valueText doesn't work with scale, try with width and height
Code edit (13 edits merged)
Please save this source code
User prompt
in preselect(), animate the movement and scale
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
in preselect(), use addChildAt to set the preselected operation front
Code edit (1 edits merged)
Please save this source code
User prompt
in updateOperations, preselect operation at index 0
Code edit (13 edits merged)
Please save this source code
User prompt
in applyOperation, implement the removal of used operation
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -19,23 +19,25 @@
var nextBackgroundH = self.attachAsset('gradientBackground', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: -1,
+ scaleY: 1,
x: centerX + 2048,
y: centerY
});
var nextBackgroundV = self.attachAsset('gradientBackground', {
anchorX: 0.5,
anchorY: 0.5,
+ scaleX: 1,
scaleY: -1,
x: centerX,
y: centerY + 2732
});
var nextBackgroundC = self.attachAsset('gradientBackground', {
anchorX: 0.5,
anchorY: 0.5,
- scaleX: 1,
- scaleY: 1,
+ scaleX: -1,
+ scaleY: -1,
x: centerX + 2048,
y: centerY + 2732
});
self.animateTransition = function () {
@@ -67,8 +69,16 @@
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Restore initial positions of graphics
+ backgroundGraphics.scale.x *= -1;
+ backgroundGraphics.scale.y *= -1;
+ nextBackgroundH.scale.x *= -1;
+ //nextBackgroundH.scale.y *= -1;
+ //nextBackgroundV.scale.x *= -1;
+ nextBackgroundV.scale.y *= -1;
+ nextBackgroundC.scale.x *= -1;
+ nextBackgroundC.scale.y *= -1;
backgroundGraphics.x += 2048;
backgroundGraphics.y += 2732;
nextBackgroundH.x += 2048;
nextBackgroundH.y += 2732;
@@ -190,8 +200,9 @@
// LevelNumberText class to represent the level number text
var LevelNumberText = Container.expand(function (initialLevel) {
var self = Container.call(this);
// Initialize level number text
+ var withOffset = false; // Define withOffset variable
var levelText = new Text2(initialLevel.toString(), {
size: 600,
fill: 0x787878,
weight: 1000,
@@ -201,15 +212,54 @@
});
levelText.anchor.set(0.5, 0.5);
levelText.alpha = 0.2;
levelText.blendMode = 2;
- levelText.x = centerX;
- levelText.y = centerY;
+ levelText.x = centerX + (withOffset ? 2048 : 0);
+ levelText.y = centerY + (withOffset ? 2732 : 0);
levelText.visible = false;
self.addChild(levelText);
+ // Initialize next level number text
+ var levelText2 = new Text2((initialLevel + 1).toString(), {
+ size: 600,
+ fill: 0x787878,
+ weight: 1000,
+ dropShadow: true,
+ dropShadowAngle: Math.PI,
+ dropShadowDistance: 10
+ });
+ levelText2.anchor.set(0.5, 0.5);
+ levelText2.alpha = 0.2;
+ levelText2.blendMode = 2;
+ levelText2.x = centerX + 2048;
+ levelText2.y = centerY + 2732;
+ levelText2.visible = false;
+ self.addChild(levelText2);
// Method to update the level number
self.updateLevel = function (newLevel) {
- levelText.setText(newLevel.toString());
+ //levelText.setText(newLevel.toString());
+ if (newLevel > 1) {
+ 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;
+ }
+ });
+ }
};
// Method to show the level number
self.show = function () {
levelText.visible = true;
@@ -217,8 +267,31 @@
// Method to hide the level number
self.hide = function () {
levelText.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) {
@@ -330,8 +403,9 @@
/****
* Game Code
****/
var levelNumberText;
+var levelNumberText2;
/************************************* GAME OBJECTS CLASSES ************************************/
/***********************************************************************************************/
// Transition to menu state
function PuzzleManager(game) {
@@ -635,8 +709,9 @@
// Initialize the game state for NEW_ROUND
log("Initializing NEW_ROUND State");
puzzleManager.initPuzzle();
levelNumberText.show();
+ levelNumberText2.show();
if (debug) {
changeGameState(GAME_STATE.PLAYING);
}
}
@@ -977,8 +1052,11 @@
resetButton.visible = false; // Keep it non-visible initially
// Initialize levelNumberText using LevelNumberText class
levelNumberText = new LevelNumberText(puzzleManager.currentLevel);
backgroundLayer.addChild(levelNumberText);
+ // Initialize levelNumberText using LevelNumberText class
+ levelNumberText2 = new LevelNumberText(puzzleManager.currentLevel + 1, true);
+ backgroundLayer.addChild(levelNumberText2);
foregroundLayer.addChild(resetButton);
// Transition to menu state
changeGameState(GAME_STATE.MENU);
}
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