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
User prompt
Please fix the bug: 'upgrade.updateUpgradeText is not a function' in or related to this line: 'upgrade.updateUpgradeText(); // Update the upgrade price text to reflect the loaded cost' Line Number: 1540
User prompt
Please fix the bug: 'upgrade.updateUpgradeText is not a function' in or related to this line: 'upgrade.updateUpgradeText(); // Update the upgrade price text to reflect the loaded cost' Line Number: 1540
Code edit (1 edits merged)
Please save this source code
User prompt
quand on click sur le bonus, joue aussi le son cheers après 1 sec
User prompt
ajoute un flash de l'écran quand on réussi a clicker sur le bonus
User prompt
quand le bonus cake apparait, joue aussi le son 'ohoh'
User prompt
quand on faire reset il faut aussi mettre à jour les étoiles
User prompt
appel start du BonusCakeManager après 1 min
Code edit (1 edits merged)
Please save this source code
User prompt
quand on click sur le bonusCake , jour le son bouns
Code edit (1 edits merged)
Please save this source code
User prompt
quand on réussi à taper le bonusCake, anime le en l'agrandissant enormément et en le rendant transparent en meme temps avant de le detruire ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
dans BonusCake ajoute un delai de 100ms dans la boucle quand on tape dessus
===================================================================
--- original.js
+++ change.js
@@ -379,9 +379,9 @@
if (!isMiniGameMode) {
return;
}
// Move towards target position with smooth movement
- self.position.x += (self.targetX - self.position.x) * 0.2;
+ self.position.x += (self.targetX - self.position.x) * 0.3;
self.x = self.position.x;
self.y = self.position.y;
// Animate chef slightly based on movement
var movementSpeed = Math.abs(self.targetX - self.position.x);
@@ -495,9 +495,11 @@
var cakeIndex = Math.floor(Math.random() * 10);
// Cake graphics
var cakeGraphics = self.attachAsset('cake_' + cakeIndex, {
anchorX: 0.5,
- anchorY: 0.5
+ anchorY: 0.5,
+ width: 40,
+ height: 40
});
// Add rotation animation
var rotationDirection = Math.random() > 0.5 ? 1 : -1;
var rotationSpeed = (Math.random() * 0.02 + 0.01) * rotationDirection;
@@ -1094,70 +1096,79 @@
});
// Upgrade class
var Upgrade = Container.expand(function () {
var self = Container.call(this);
- // Upgrade properties
- self.id = '';
- self.name = '';
- self.description = '';
- self.price = 0;
- self.cakesPerSecondIncrease = 0;
- self.cakesPerClickIncrease = 0;
- self.level = 0;
- // Upgrade graphics
- var upgradeGraphics = self.attachAsset('buttonPrice', {
+ // Create a shadow effect by adding a black tinted, semi-transparent duplicate of upgradeGraphics
+ var shadowGraphics = self.attachAsset('upgrade', {
anchorX: 0.5,
anchorY: 0.5
});
- // Upgrade icon
- var icon = self.attachAsset('cake_0', {
+ shadowGraphics.tint = 0x000000; // Tint the shadow black
+ shadowGraphics.alpha = 0.5; // Make the shadow semi-transparent
+ shadowGraphics.y = 10; // Position the shadow slightly below the upgrade button
+ self.addChild(shadowGraphics);
+ var upgradeGraphics = self.attachAsset('upgrade', {
anchorX: 0.5,
- anchorY: 0.5,
- width: 60,
- height: 60
+ anchorY: 0.5
});
- icon.x = -120;
- self.addChild(icon);
- // Upgrade name text
- var nameText = new Text2('Upgrade', {
- size: 24,
- fill: 0xFFFFFF,
- fontWeight: 'bold'
+ // Attach the cake_1 image on top of the upgrade button
+ self.cakeGraphics = self.attachAsset('cake_1', {
+ anchorX: 0.5,
+ anchorY: 0.5
});
- nameText.anchor.set(0.5, 0.5);
- nameText.x = 0;
- nameText.y = -upgradeGraphics.height / 4;
- self.addChild(nameText);
- // Upgrade price text
- var upgradeText = new Text2('10', {
- size: 24,
- fill: 0xFFD700,
- fontWeight: 'bold',
+ self.cakeGraphics.y = -10; // Move the cake slightly higher on the upgrade button
+ self.addChild(self.cakeGraphics);
+ var upgradesLabel = new Text2('Upgrades', {
+ size: 60,
+ fill: 0x808080,
+ // Gray color
+ fontWeight: '900'
+ });
+ upgradesLabel.anchor.set(0.5, 1); // Center the text horizontally and align it to the bottom
+ upgradesLabel.y = self.cakeGraphics.y - self.cakeGraphics.height / 2 - 160; // Move text slightly higher above the cake image
+ upgradesLabel.fill = 0x808080; // Change text color to gray
+ self.addChild(upgradesLabel);
+ var upgradeLabel = new Text2('Cake', {
+ size: 60,
+ fill: 0xFF8C00,
+ // Dark orange color
+ fontWeight: '900',
dropShadow: true,
dropShadowColor: 0x000000,
dropShadowBlur: 5,
dropShadowDistance: 5
});
+ upgradeLabel.anchor.set(0.5, 1); // Center the text horizontally and align it to the bottom
+ upgradeLabel.y = self.cakeGraphics.y - self.cakeGraphics.height / 2 - 50; // Position text even higher above the cake image
+ self.addChild(upgradeLabel);
+ self.cost = 10; // Initial cost of the upgrade
+ self.multiplier = 1; // Score multiplier
+ self.updateCost = function () {
+ self.cost = upgradePrices[Math.min(upgradeLevel + 1, upgradePrices.length - 1)]; // Update the cost using the upgradePrices array
+ storage.upgradeCost = self.cost; // Save the updated upgrade cost
+ };
+ self.increaseMultiplier = function () {
+ self.multiplier += 1; // Increase the multiplier by 1
+ };
+ var upgradeText = new Text2('$' + self.cost, {
+ size: 80,
+ fill: 0xFFA500,
+ // Orange color
+ fontWeight: '900',
+ dropShadow: true,
+ dropShadowColor: 0x000000,
+ dropShadowBlur: 5,
+ dropShadowDistance: 5
+ });
upgradeText.anchor.set(0.5, 0);
upgradeText.x = 0;
upgradeText.y = upgradeGraphics.height / 2 + 20; // Position text below the upgrade button
self.addChild(upgradeText);
- // Add cake graphics
- self.cakeGraphics = self.attachAsset('cake_0', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 80,
- height: 80
- });
- self.cakeGraphics.x = 120;
- self.addChild(self.cakeGraphics);
- // Update upgrade text
self.updateUpgradeText = function () {
- upgradeText.setText(formatPrice(self.price));
+ upgradeText.setText(formatPrice(self.cost));
};
- // Update cake graphics
self.updateCakeGraphics = function () {
- var cakeIndex = Math.min(self.level + 1, 9);
+ var cakeIndex = Math.min(upgradeLevel + 1, 9);
tween(self.cakeGraphics, {
alpha: 0
}, {
duration: 500,
@@ -1165,13 +1176,11 @@
onFinish: function onFinish() {
self.removeChild(self.cakeGraphics);
self.cakeGraphics = self.attachAsset('cake_' + cakeIndex, {
anchorX: 0.5,
- anchorY: 0.5,
- width: 80,
- height: 80
+ anchorY: 0.5
});
- self.cakeGraphics.x = 120;
+ self.cakeGraphics.y = -10;
self.cakeGraphics.alpha = 0;
self.addChild(self.cakeGraphics);
tween(self.cakeGraphics, {
alpha: 1
@@ -1181,68 +1190,64 @@
});
}
});
};
- // Initialize upgrade
- self.initialize = function (id, name, description, basePrice, cakesPerSecondIncrease, cakesPerClickIncrease, iconAsset) {
- self.id = id;
- self.name = name;
- self.description = description;
- self.basePrice = basePrice;
- self.price = basePrice;
- self.cakesPerSecondIncrease = cakesPerSecondIncrease;
- self.cakesPerClickIncrease = cakesPerClickIncrease;
- self.level = 0;
- // Update texts
- nameText.text = name;
- upgradeText.text = basePrice;
- upgradeText.setText(formatPrice(self.price));
- // Update icon
- if (iconAsset) {
- self.removeChild(icon);
- icon = self.attachAsset(iconAsset, {
- anchorX: 0.5,
- anchorY: 0.5,
- width: 60,
- height: 60
+ self.onClick = function () {
+ if (currentScore >= self.cost) {
+ currentScore -= self.cost; // Deduct the cost from the current score
+ score.updateScore(currentScore); // Update the score display
+ self.updateCost(); // Update the cost for the next upgrade
+ storage.upgradeMultiplier = self.multiplier; // Save the updated multiplier
+ self.increaseMultiplier(); // Increase the score multiplier
+ self.updateUpgradeText(); // Update the upgrade text
+ upgradeLevel = Math.min(upgradeLevel + 1, 9); // Increment upgrade level, max 9
+ storage.upgradeLevel = upgradeLevel; // Save the updated upgrade level
+ self.updateCakeGraphics(); // Update cake graphics based on new upgrade level
+ confettiManager.popCakes(bigCake.x, bigCake.y, 5); // Call popCakes using bigCake's coordinates
+ LK.getSound('buySound').play(); // Play buy sound when upgrade is purchased
+ // Animate the upgrade button
+ tween(upgradeGraphics, {
+ scaleX: 1.2,
+ scaleY: 1.2
+ }, {
+ duration: 200,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(upgradeGraphics, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 200,
+ easing: tween.easeIn
+ });
+ }
});
- icon.x = -120;
- self.addChild(icon);
- }
- return self;
- };
- // Update upgrade price based on level
- self.updatePrice = function () {
- self.price = Math.floor(self.basePrice * Math.pow(1.15, self.level));
- upgradeText.setText(formatPrice(self.price));
- };
- // Buy upgrade
- self.buy = function () {
- // Check if player has enough cakes
- if (cakes >= self.price) {
- // Subtract price from cakes
- cakes -= self.price;
- updateCakeCounter();
- // Increase level
- self.level++;
- upgradeText.setText('Lv. ' + self.level);
- // Update price
- self.updatePrice();
- // Increase cakes per second
- cakesPerSecond += self.cakesPerSecondIncrease;
- updateCakesPerSecondCounter();
- // Increase cakes per click
- cakesPerClick += self.cakesPerClickIncrease;
- // Play purchase sound
- LK.getSound('achat').play();
- // Create animation
- var animation = new CakeAnimation();
- animation.x = self.x;
- animation.y = self.y;
- foregroundContainer.addChild(animation);
} else {
- // Not enough cakes
- LK.getSound('errorsond').play(); // Play error sound
+ // Play error sound if not enough cakes
+ LK.getSound('errorsond').play();
+ // Shake the upgrade button to indicate error
+ tween(upgradeGraphics, {
+ x: 10
+ }, {
+ duration: 50,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(upgradeGraphics, {
+ x: -10
+ }, {
+ duration: 100,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(upgradeGraphics, {
+ x: 0
+ }, {
+ duration: 50,
+ easing: tween.easeInOut
+ });
+ }
+ });
+ }
+ });
}
};
return self;
});
@@ -1355,9 +1360,8 @@
* Assets
* Initialize all game assets including images, sounds, and music
****/
// Declare game variables
-var cakes = 0; // Initialize cakes variable to track the number of cakes
var bonusCakeManager; // Declare bonusCakeManager globally
var cakeList = ['cake_0', 'cake_1', 'cake_2', 'cake_3', 'cake_4', 'cake_5', 'cake_6', 'cake_8', 'cake_9'];
var isResetConfirmationDisplayed = false; // Track if reset confirmation is displayed
var upgradeLevel = storage.upgradeLevel || 0; // Load saved upgrade level or default to 0
@@ -1448,29 +1452,28 @@
endMiniGame();
}
}, 1000);
// Set up input handling for mini-game
- LK.stage.on('mousemove', handleMiniGamePointerMove);
- LK.stage.on('mousedown', handleMiniGamePointerMove);
+ LK.stage.on('move', handleMiniGamePointerMove);
+ LK.stage.on('down', handleMiniGamePointerMove);
}
// Handle mini-game pointer movement
function handleMiniGamePointerMove(event) {
if (!isMiniGameMode) {
return;
}
// Get mouse position
- var mouseX = event.clientX || event.pageX;
- miniGameChef.setTargetPosition(mouseX);
+ miniGameChef.setTargetPosition(event.x);
}
// End mini-game
function endMiniGame() {
// Stop timer
LK.clearInterval(miniGameTimer);
// Stop cake manager
miniGameCakeManager.stop();
// Remove input handlers
- LK.stage.off('mousemove', handleMiniGamePointerMove);
- LK.stage.off('mousedown', handleMiniGamePointerMove);
+ LK.stage.off('move', handleMiniGamePointerMove);
+ LK.stage.off('down', handleMiniGamePointerMove);
// Calculate reward based on score
miniGameReward = Math.floor(miniGameCakeManager.gameScore / 10);
// Add reward to player's cakes
cakes += miniGameReward;
@@ -1605,9 +1608,9 @@
miniGameButton.x = 2048 / 2;
miniGameButton.y = 2732 / 2 + 400;
foregroundContainer.addChild(miniGameButton);
// Set up game loop
- LK.setInterval(gameLoop, 16); // ~60fps
+ LK.onUpdate(gameLoop);
}
// Call the function to initialize game variables
initializeGameVariables();
// Game loop
@@ -1631,5 +1634,6 @@
miniGameCakeManager.update(miniGameChef);
}
}
// Initialize cakesPerSecondCounter
-var cakesPerSecondCounter = 0;
\ No newline at end of file
+var cakesPerSecondCounter = 0;
+LK.onUpdate(gameLoop);
\ 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