User prompt
ajouter une class pour le chef sans l'ajouter au jeu. integre dans la classe la possibiliter de le déplacer horizontalement
Code edit (11 edits merged)
Please save this source code
User prompt
quand on appuie sur switch button: - appel switchToMiniGame dans switchToMiniGame : anime le déplacement de miniGameContainer de y = 2732 à y=0 et anime le mouvement de mainGameContainer de y = 0 à y = -2732
Code edit (1 edits merged)
Please save this source code
User prompt
crée un class pour le bouton switch mais ne l'ajoute pas
User prompt
Please fix the bug: 'Timeout.tick error: updateCakeCounter is not defined' in or related to this line: 'updateCakeCounter();' Line Number: 1665
User prompt
Please fix the bug: 'Timeout.tick error: cakesPerSecond is not defined' in or related to this line: 'cakes += cakesPerSecond;' Line Number: 1664
User prompt
Please fix the bug: 'Timeout.tick error: cakes is not defined' in or related to this line: 'cakes += cakesPerSecond;' Line Number: 1663
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: cakes is not defined' in or related to this line: 'cakes += miniGameReward;' Line Number: 1524
User prompt
Please fix the bug: 'LK.onUpdate is not a function' in or related to this line: 'self.destroy();' Line Number: 531
User prompt
Please fix the bug: 'LK.onUpdate is not a function' in or related to this line: 'self.destroy();' Line Number: 528
User prompt
Please fix the bug: 'LK.onUpdate is not a function' in or related to this line: 'LK.onUpdate(gameLoop);' Line Number: 1654
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: cakes is not defined' in or related to this line: 'cakes += miniGameReward;' Line Number: 1518
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'add')' in or related to this line: 'LK.ticker.add(gameLoop);' Line Number: 1651
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: updateAnimations is not defined' in or related to this line: 'updateAnimations(dt);' Line Number: 1638
User prompt
Please fix the bug: 'Timeout.tick error: cakesPerSecondCounter is not defined' in or related to this line: 'function gameLoop(dt) {' Line Number: 1626
User prompt
Please fix the bug: 'Timeout.tick error: cakesPerSecondCounter is not defined' in or related to this line: 'cakesPerSecondCounter += dt;' Line Number: 1627
User prompt
Please fix the bug: 'LK.onUpdate is not a function' in or related to this line: 'LK.onUpdate(gameLoop);' Line Number: 1620
User prompt
Please fix the bug: 'Graphics is not a constructor' in or related to this line: 'var shadow = new Graphics();' Line Number: 407
User prompt
Please fix the bug: 'Graphics is not a constructor' in or related to this line: 'var panel = new Graphics();' Line Number: 800
User prompt
Please fix the bug: 'upgrade.updateCakeGraphics is not a function' in or related to this line: 'upgrade.updateCakeGraphics(); // Update cake graphics based on new upgrade level' Line Number: 1544
User prompt
Please fix the bug: 'upgrade.updateCakeGraphics is not a function' in or related to this line: 'upgrade.updateCakeGraphics(); // Update cake graphics based on new upgrade level' Line Number: 1544
===================================================================
--- original.js
+++ change.js
@@ -143,9 +143,8 @@
self.cost = autoClickerPrices[Math.min(self.autoClickerCount, autoClickerPrices.length - 1)]; // Update the cost using the autoClickerPrices array
storage.autoClickerCost = self.cost; // Save the updated auto clicker cost
self.updatePriceText(); // Update the price text to reflect the new cost
LK.getSound('buyAutoclickerSound').play(); // Play buyAutoclickerSound when an autoclicker is purchased
- autoClickerText.fill = currentScore >= self.cost ? 0x00FF00 : 0xFF0000; // Update text color based on affordability
// Animate the autoClicker button
tween(autoClickerGraphics, {
scaleX: 0.9,
scaleY: 0.9
@@ -502,8 +501,11 @@
anchorX: 0.5,
anchorY: 0.5
});
// Add any additional properties or methods for the switch button here
+ self.on('down', function (x, y, obj) {
+ switchToMiniGame();
+ });
});
// Upgrade class
var Upgrade = Container.expand(function () {
var self = Container.call(this);
@@ -847,8 +849,9 @@
newCakeButton.newCake.onClick();
});
}
// Declare game variables
+var mainGameContainer;
var backgroundContainer;
var middleContainer;
var foregroundContainer;
var currentScore;
@@ -857,23 +860,48 @@
var timeElapsed;
var clicksSinceLastSession;
var autoClicker;
var upgrade;
-var autoClickerText;
var bigCake;
var resetButton;
var switchButton;
var board;
+////////////////////////////////////////////////////////////////////////
+////////////////////////// MINI GAME CODE /////////////////////////////
+////////////////////////////////////////////////////////////////////////
+var isMiniGameRunning = false;
+var miniGameContainer;
+var miniGameBackgroundContainer;
+var miniGamebackground;
+function switchToMiniGame() {
+ isMiniGameRunning = true;
+ miniGameContainer.visible = true;
+ tween(miniGameContainer, {
+ y: 0
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut
+ });
+ tween(mainGameContainer, {
+ y: -2732
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut
+ });
+}
+////////////////////////////////////////////////////////////////////////
// Initialize game variables
function initializeGameVariables() {
+ mainGameContainer = new Container();
+ game.addChild(mainGameContainer);
backgroundContainer = new Container();
- game.addChild(backgroundContainer);
+ mainGameContainer.addChild(backgroundContainer);
// Initialize middleContainer
middleContainer = new Container();
- game.addChild(middleContainer);
+ mainGameContainer.addChild(middleContainer);
// Initialize foregroundContainer
foregroundContainer = new Container();
- game.addChild(foregroundContainer);
+ mainGameContainer.addChild(foregroundContainer);
background = backgroundContainer.addChild(LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5
}));
@@ -890,9 +918,9 @@
bigCake = middleContainer.addChild(new BigCake());
bigCake.x = 2048 / 2;
bigCake.y = 2732 / 2;
// Initialize score
- score = game.addChild(new Score());
+ score = foregroundContainer.addChild(new Score());
score.x = 2048 / 2;
score.y = 30; // Position score even higher at the top center
currentScore = storage.score || 0; // Load saved score or default to 0
score.updateScore(currentScore); // Refresh the score display with the loaded score
@@ -935,30 +963,38 @@
bonusCakeManager.start(); // Start the bonus cake manager after 1 minute
}, 60000);
resetButton.x = 2048 - resetButton.width / 2 - 40; // Add margin to the right edge
resetButton.y = score.y + score.height / 2 + 10; // Adjust reset button position to be slightly higher
- // Initialize auto clicker text
- autoClickerText = new Text2('Auto Clicker: $' + autoClicker.cost, {
- size: 100,
- fill: currentScore >= autoClicker.cost ? 0x00FF00 : 0xFF0000
- });
- autoClickerText.anchor.set(0.5, 0);
- autoClickerText.x = autoClicker.x;
- autoClickerText.y = autoClicker.y - autoClicker.height / 2 - 50; // Position text above the auto clicker button
- game.addChild(autoClickerText);
- // Update autoClickerText immediately after loading the game
autoClicker.x = 2048 - autoClicker.width / 2 - 10; // Position auto clicker button on the right side of the screen
autoClicker.y = 2732 / 2 + 160; // Position auto clicker button slightly lower on the screen
// Event listener for auto clicker clicks
autoClicker.on('down', function (x, y, obj) {
autoClicker.onClick();
});
switchButton = new SwitchButton();
switchButton.x = 1024;
- switchButton.y = 2732;
+ switchButton.y = 2732 - switchButton.height * 0.5;
+ foregroundContainer.addChild(switchButton);
// Play bakery music in a loop throughout the game
LK.playMusic('musiqueclicker', {
loop: true
});
}
+function initializeminiGameVariables() {
+ miniGameContainer = new Container();
+ miniGameContainer.y = 2732;
+ game.addChild(miniGameContainer);
+ miniGameContainer.visible = false;
+ miniGameBackgroundContainer = new Container();
+ miniGameContainer.addChild(miniGameBackgroundContainer);
+ miniGamebackground = miniGameBackgroundContainer.addChild(LK.getAsset('background', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ }));
+ miniGamebackground.x = 2048 / 2;
+ miniGamebackground.y = 2732 / 2;
+ miniGamebackground.scaleX = 2048 / miniGamebackground.width; // Scale background to fit the game width
+ miniGamebackground.scaleY = 2732 / miniGamebackground.height; // Scale background to fit the game height
+}
// Call the function to initialize game variables
-initializeGameVariables();
\ No newline at end of file
+initializeGameVariables();
+initializeminiGameVariables();
\ No newline at end of file
a button saying 'reset'. In-Game asset. 2d. Blank background. High contrast.
enlève ça
interieure de patiserie. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
gâteau ( pas réaliste ). Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
sparkles
gâteau. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
gâteau. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
gâteau. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
dessin de toque de chef
étoile dorée toute simple comme dans les commentaires d'un site web
une patisserie (gâteau) simple. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
interieure de patiserie vide avec uniquement le sol et les murs. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
trace blanche verticale d'un effet de coup de ninja
Vue de face centrée d'une machine magique en forme de pièce montée arc-en-ciel avec une petite entrée d'alimentation en bas au milieu, un très grand hublot central et un tube transparent dirigé vers le haut.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
errorsond
Sound effect
relaxsond
Sound effect
clickSound
Sound effect
musiqueclicker
Music
buySound
Sound effect
resetSound
Sound effect
buyAutoclickerSound
Sound effect
clearedSound
Sound effect
bonusSound
Sound effect
ohoh
Sound effect
cheers
Sound effect
squashingSound
Sound effect
CutSound
Sound effect
youpi
Sound effect
canonSound
Sound effect
yeahh
Sound effect
nooo
Sound effect
machineError
Sound effect
aspire
Sound effect