Code edit (17 edits merged)
Please save this source code
User prompt
pour la lumiere centrale ajoute aussi une animation de rotation ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
l'animation des lumière de la machine doit etre faite en boucle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Anime la CakeMachine en faisant changer la transparence des lumières en boucle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (3 edits merged)
Please save this source code
User prompt
ajoute lightCentral et lightSide à CakeMachine
Code edit (1 edits merged)
Please save this source code
Code edit (10 edits merged)
Please save this source code
User prompt
stop le CakeRainManager quand on est pas en mode mini jeu 1
Code edit (1 edits merged)
Please save this source code
User prompt
dans toggleMiniGame; ajoute un flag pour empêcher un autre appel à toggleMiniGame tant que les animations de transition ne sont pas terminées
Code edit (1 edits merged)
Please save this source code
Code edit (10 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'width')' in or related to this line: 'switchButtonMini.x = switchButtonThird.width * 0.5;' Line Number: 1736
Code edit (1 edits merged)
Please save this source code
Code edit (16 edits merged)
Please save this source code
User prompt
permet la découpe des gateaux 'confetti' dans le jeu principal sans altérer le mini-jeu. Reprend les memes éléments : - ajouter un CutEffect - crééer 2 minicakes
User prompt
permet la découpe des gateaux 'confetti' dans le jeu principal sans altérer le mini-jeu
User prompt
Change le nombre de nains à 20
User prompt
Joue le son youpi quand un nain attrape un minicake
User prompt
Le squashingSound doit être joué dés le début du squashing anim, pas à la fin
User prompt
Joue cut sound quand un gâteau est coupé en miniCakes
User prompt
Joue squashing sound quand un nain se fait écraser
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -389,8 +389,11 @@
miniGameCurrentCakes.push(cake);
miniGameMiddlegroundContainer.addChild(cake);
};
self.update = function () {
+ if (isMiniGameRunning !== 1) {
+ return; // Stop updating if not in mini-game mode 1
+ }
for (var i = self.cakes.length - 1; i >= 0; i--) {
var cake = self.cakes[i];
cake.y += cake.speedY;
if (cake.y > 2732 + cake.height / 2) {
@@ -530,13 +533,69 @@
self.targetCooldown = 0; // Cooldown counter for changing targets
self.maxTargetCooldown = 60; // 60 frames = 1 seconde à 60 FPS
self.idleTime = 0; // Compteur pour le temps d'inactivité
self.maxIdleTime = 30; // Temps maximum d'inactivité avant de chercher activement une cible
+ self.waitingAtCenter = false;
// Update function for movement and animation
self.update = function () {
- if (isMiniGameRunning !== 1 || self.isSquashing) {
+ if (isMiniGameRunning !== 1 && isMiniGameRunning !== 2 || self.isSquashing) {
return;
- } // Only update if the mini-game is active and not being squashed
+ } // Only update if the mini-game or third game is active and not being squashed
+ // Comportement spécifique au troisième jeu
+ if (isMiniGameRunning === 2) {
+ // Animation du nain
+ self.animationCounter++;
+ if (self.animationCounter >= self.animationDelay) {
+ self.animationCounter = 0;
+ if (self.state === 'full') {
+ dwarfFullFrame1.visible = !dwarfFullFrame1.visible;
+ dwarfFullFrame2.visible = !dwarfFullFrame2.visible;
+ dwarfEmptyFrame1.visible = false;
+ dwarfEmptyFrame2.visible = false;
+ } else {
+ dwarfEmptyFrame1.visible = !dwarfEmptyFrame1.visible;
+ dwarfEmptyFrame2.visible = !dwarfEmptyFrame2.visible;
+ dwarfFullFrame1.visible = false;
+ dwarfFullFrame2.visible = false;
+ }
+ }
+ // Gestion du comportement du nain dans le troisième jeu
+ if (self.state === 'full') {
+ // Le nain se déplace vers x=1024
+ if (self.x > 1024) {
+ self.x -= self.speedX;
+ self.scale.x = -1; // Orientation vers la gauche
+ } else if (!self.waitingAtCenter) {
+ // Arrivé au centre, attendre 1 seconde
+ self.waitingAtCenter = true;
+ LK.setTimeout(function () {
+ // Après 1 seconde, passer en mode empty et continuer
+ self.state = 'empty';
+ dwarfFullFrame1.visible = false;
+ dwarfFullFrame2.visible = false;
+ dwarfEmptyFrame1.visible = true;
+ dwarfEmptyFrame2.visible = false;
+ self.waitingAtCenter = false;
+ }, 1000);
+ }
+ } else {
+ // En mode empty, continuer jusqu'à x=-300
+ if (self.x > -300) {
+ self.x -= self.speedX;
+ self.scale.x = -1; // Orientation vers la gauche
+ } else {
+ // Réinitialiser le nain à droite en mode full
+ self.x = 2300;
+ self.state = 'full';
+ dwarfFullFrame1.visible = true;
+ dwarfFullFrame2.visible = false;
+ dwarfEmptyFrame1.visible = false;
+ dwarfEmptyFrame2.visible = false;
+ }
+ }
+ return; // Ne pas exécuter le reste du code pour le mini-jeu
+ }
+ // Comportement original du mini-jeu (isMiniGameRunning === 1)
// Check if the dwarf reaches x = -300 and switch mode from full to empty
if (self.x <= -300 && self.state === 'full') {
self.state = 'empty';
self.x = 2348;
@@ -1067,8 +1126,30 @@
self.on('down', function (x, y, obj) {
toggleMiniGame();
});
});
+// ThirdDwarfManager class for the third game
+var ThirdDwarfManager = Container.expand(function () {
+ var self = Container.call(this);
+ self.spawnDwarf = function () {
+ var dwarf = new Dwarf();
+ dwarf.x = 2300; // Position initiale à droite
+ dwarf.y = 2732 - 180; // Base y position
+ dwarf.speedX = 5; // Vitesse fixe pour un mouvement uniforme
+ dwarf.state = 'full'; // Commencer en mode full
+ thirdGameDwarfs.push(dwarf); // Ajouter au tableau global thirdGameDwarfs
+ thirdGameMiddlegroundContainer.addChild(dwarf);
+ };
+ self.start = function () {
+ // Vider le tableau des nains du troisième jeu
+ thirdGameDwarfs = [];
+ // Spawn exactly 3 dwarfs
+ for (var i = 0; i < 3; i++) {
+ self.spawnDwarf();
+ }
+ };
+ return self;
+});
// Upgrade class
var Upgrade = Container.expand(function () {
var self = Container.call(this);
// Create a shadow effect by adding a black tinted, semi-transparent duplicate of upgradeGraphics
@@ -1450,8 +1531,10 @@
var thirdGameForegroundContainer;
var thirdGameBackground;
var switchButtonThird;
var isTransitioning = false; // Flag to prevent multiple calls during transitions
+var thirdDwarfManager; // Variable globale pour le ThirdDwarfManager
+var thirdGameDwarfs = []; // Variable globale pour stocker les nains du troisième jeu
function toggleMiniGame() {
if (isTransitioning) {
return;
} // Exit if a transition is already in progress
@@ -1722,16 +1805,20 @@
anchorY: 0.5
}));
thirdGameBackground.x = 2048 / 2;
thirdGameBackground.y = 2732 / 2;
- thirdGameBackground.scaleX = 2048 / thirdGameBackground.width; // Scale background to fit the game width
+ thirdGameBackground.scaleX = -2048 / thirdGameBackground.width; // Scale background to fit the game width
thirdGameBackground.scaleY = 2732 / thirdGameBackground.height; // Scale background to fit the game height
// Ajouter uniquement le bouton de changement de jeu
switchButtonThird = new SwitchButton();
switchButtonThird.x = 1024;
switchButtonThird.y = switchButtonThird.height * 0.5;
switchButtonThird.scale.y = -1;
thirdGameForegroundContainer.addChild(switchButtonThird);
+ // Create and start the ThirdDwarfManager
+ thirdDwarfManager = new ThirdDwarfManager();
+ thirdGameMiddlegroundContainer.addChild(thirdDwarfManager);
+ thirdDwarfManager.start();
}
// Call the function to initialize game variables
initializeGameVariables();
initializeminiGameVariables();
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