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
User prompt
dans performImpatienceAnimation, change aléatoirement la direction du Nain (scaleX) à 1 ou -1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'performImpatienceAnimation')' in or related to this line: 'self.performImpatienceAnimation = function () {' Line Number: 1678
User prompt
ajoute une petite animation d'impatience (de petits sauts rapide) au Nain quand il est arrivé au x de son gateau cible et qu'il attend. crée une fonction dédiée dans la classe. n'utilise pas le jumpPlayed qui est pour autre chose.
User prompt
l'animation de saut doit etre faite en boucle après que le Nain ai trouvé sa cible et qu'il est arrivé à proximité du x du gateau
Code edit (15 edits merged)
Please save this source code
User prompt
ajoute une petite animation de petits sauts au Nain quand il est arrivé au x de son gateau cible et qu'il attend. crée une fonction dédiée dans la classe
===================================================================
--- original.js
+++ change.js
@@ -5,9 +5,9 @@
var storage = LK.import("@upit/storage.v1", {
score: 0,
autoClickerCount: 0,
upgradeMultiplier: 1,
- isMiniGameRunning: false
+ isMiniGameRunning: 0
});
/****
* Classes
@@ -1429,9 +1429,9 @@
var board;
////////////////////////////////////////////////////////////////////////
////////////////////////// MINI GAME CODE /////////////////////////////
////////////////////////////////////////////////////////////////////////
-var isMiniGameRunning = false;
+var isMiniGameRunning = 0;
var miniGameContainer;
var miniGameBackgroundContainer;
var miniGameMiddlegroundContainer;
var miniGameForegroundContainer;
@@ -1442,52 +1442,98 @@
var miniGameDwarfCount = 7; // Nombre de nains à créer
var miniGameCurrentCakes = []; // Global array to store falling cakes
var miniGameMiniCakes = []; // Global array to track mini cakes
var baseDwarfY = 2732 - 180;
+// Variables pour le thirdGame
+var thirdGameContainer;
+var thirdGameBackgroundContainer;
+var thirdGameMiddlegroundContainer;
+var thirdGameForegroundContainer;
+var thirdGameBackground;
+var switchButtonThird;
function toggleMiniGame() {
- if (isMiniGameRunning) {
- storage.isMiniGameRunning = false; // Update storage
- // Back to Main game
- isMiniGameRunning = false;
- mainGameContainer.visible = true;
- tween(miniGameContainer, {
+ // Gestion des transitions entre les différents jeux
+ if (isMiniGameRunning === 0) {
+ // Passage du jeu principal au minijeu (slide vers le bas)
+ isMiniGameRunning = 1;
+ storage.isMiniGameRunning = 1; // Update storage
+ miniGameContainer.y = -2732; // Positionner au-dessus pour l'animation
+ miniGameContainer.visible = true;
+ // Animation du jeu principal vers le bas
+ tween(mainGameContainer, {
y: 2732
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
- miniGameContainer.visible = false;
+ mainGameContainer.visible = false;
}
});
- tween(mainGameContainer, {
+ // Animation du minijeu vers le bas
+ tween(miniGameContainer, {
y: 0
}, {
duration: 1000,
easing: tween.easeInOut
});
- } else {
- isMiniGameRunning = true;
- storage.isMiniGameRunning = true; // Update storage
- miniGameContainer.visible = true;
+ } else if (isMiniGameRunning === 1) {
+ // Passage du minijeu au thirdGame (slide vers la gauche)
+ storage.isMiniGameRunning = 2; // Update storage
+ isMiniGameRunning = 2;
+ thirdGameContainer.y = 0;
+ thirdGameContainer.x = -2048; // Positionner à droite pour l'animation
+ thirdGameContainer.visible = true;
+ // Animation du minijeu vers la gauche
tween(miniGameContainer, {
- y: 0
+ x: 2048
}, {
duration: 1000,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ miniGameContainer.visible = false;
+ miniGameContainer.x = 0; // Réinitialiser la position X
+ }
+ });
+ // Animation du thirdGame vers la gauche
+ tween(thirdGameContainer, {
+ x: 0
+ }, {
+ duration: 1000,
easing: tween.easeInOut
});
- tween(mainGameContainer, {
+ } else if (isMiniGameRunning === 2) {
+ // Retour au jeu principal depuis le thirdGame (slide vers le haut)
+ isMiniGameRunning = 0;
+ storage.isMiniGameRunning = 0; // Update storage
+ mainGameContainer.y = 2732; // Positionner en bas pour l'animation
+ mainGameContainer.visible = true;
+ // Animation du thirdGame vers le haut
+ tween(thirdGameContainer, {
y: -2732
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
- mainGameContainer.visible = false;
+ thirdGameContainer.visible = false;
+ thirdGameContainer.y = 0; // Réinitialiser la position Y
+ thirdGameContainer.x = -2048; // Réinitialiser la position X
}
});
+ // Animation du jeu principal vers le haut
+ tween(mainGameContainer, {
+ y: 0
+ }, {
+ duration: 1000,
+ easing: tween.easeInOut
+ });
}
}
game.down = function (x, y, obj) {
- if (isMiniGameRunning) {}
+ if (isMiniGameRunning === 1) {
+ // Code spécifique au minijeu
+ } else if (isMiniGameRunning === 2) {
+ // Code spécifique au thirdGame
+ }
};
////////////////////////////////////////////////////////////////////////
// Initialize game variables
function initializeGameVariables() {
@@ -1573,22 +1619,49 @@
switchButton = new SwitchButton();
switchButton.x = 1024;
switchButton.y = 2732 - switchButton.height * 0.5;
foregroundContainer.addChild(switchButton);
+ // Ajout du gestionnaire d'événement pour le bouton de changement de jeu
+ switchButton.on('down', function (x, y, obj) {
+ toggleMiniGame();
+ });
// Play bakery music in a loop throughout the game
LK.playMusic('musiqueclicker', {
loop: true
});
- // Check if the player was in mini-game mode and switch automatically after 1 second
- if (storage.isMiniGameRunning) {
- LK.setTimeout(function () {
- toggleMiniGame();
- }, 500);
- }
+ // Restaurer l'état du jeu selon la valeur de storage.isMiniGameRunning
+ LK.setTimeout(function () {
+ // Récupérer l'état sauvegardé
+ isMiniGameRunning = storage.isMiniGameRunning || 0;
+ // Configurer les containers selon l'état sauvegardé
+ if (isMiniGameRunning === 1) {
+ // Si le joueur était dans le minijeu
+ mainGameContainer.visible = false;
+ mainGameContainer.y = 2732;
+ miniGameContainer.visible = true;
+ miniGameContainer.y = 0;
+ thirdGameContainer.visible = false;
+ } else if (isMiniGameRunning === 2) {
+ // Si le joueur était dans le thirdGame
+ mainGameContainer.visible = false;
+ miniGameContainer.visible = false;
+ miniGameContainer.x = -2048;
+ thirdGameContainer.visible = true;
+ thirdGameContainer.x = 0;
+ thirdGameContainer.y = 0;
+ } else {
+ // Si le joueur était dans le jeu principal (ou valeur par défaut)
+ mainGameContainer.visible = true;
+ mainGameContainer.y = 0;
+ miniGameContainer.visible = false;
+ thirdGameContainer.visible = false;
+ }
+ }, 100);
}
function initializeminiGameVariables() {
miniGameContainer = new Container();
- miniGameContainer.y = 2732;
+ miniGameContainer.y = 2732; // Position initiale hors écran
+ miniGameContainer.x = 0;
game.addChild(miniGameContainer);
miniGameContainer.visible = false;
miniGameBackgroundContainer = new Container();
miniGameContainer.addChild(miniGameBackgroundContainer);
@@ -1604,12 +1677,18 @@
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
switchButtonMini = new SwitchButton();
- switchButtonMini.x = 1024;
- switchButtonMini.y = switchButtonMini.height * 0.5;
+ switchButtonThird = new SwitchButton(); // Initialize switchButtonThird before using it
+ switchButtonMini.x = switchButtonThird.width * 0.5;
+ switchButtonMini.y = 1366;
+ switchButtonMini.rotation = -Math.PI / 2;
switchButtonMini.scale.y = -1;
miniGameForegroundContainer.addChild(switchButtonMini);
+ // Ajout du gestionnaire d'événement pour le bouton de changement de jeu
+ switchButtonMini.on('down', function (x, y, obj) {
+ toggleMiniGame();
+ });
// Dwarfs
miniGameDwarfs = []; // Réinitialiser le tableau des nains
for (var i = 0; i < miniGameDwarfCount; i++) {
var dwarf = new Dwarf(i);
@@ -1622,7 +1701,40 @@
var cakeRainManager = new CakeRainManager();
miniGameMiddlegroundContainer.addChild(cakeRainManager);
cakeRainManager.start();
}
+function initializeThirdGameVariables() {
+ thirdGameContainer = new Container();
+ thirdGameContainer.y = 0;
+ thirdGameContainer.x = 2048; // Position initiale hors écran (à droite)
+ game.addChild(thirdGameContainer);
+ thirdGameContainer.visible = false;
+ thirdGameBackgroundContainer = new Container();
+ thirdGameContainer.addChild(thirdGameBackgroundContainer);
+ thirdGameMiddlegroundContainer = new Container();
+ thirdGameContainer.addChild(thirdGameMiddlegroundContainer);
+ thirdGameForegroundContainer = new Container();
+ thirdGameContainer.addChild(thirdGameForegroundContainer);
+ // Utiliser le même fond que le miniGame pour le moment
+ thirdGameBackground = thirdGameBackgroundContainer.addChild(LK.getAsset('miniGameBackground', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ }));
+ thirdGameBackground.x = 2048 / 2;
+ thirdGameBackground.y = 2732 / 2;
+ 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);
+ // Ajout du gestionnaire d'événement pour le bouton de changement de jeu
+ switchButtonThird.on('down', function (x, y, obj) {
+ toggleMiniGame();
+ });
+}
// Call the function to initialize game variables
initializeGameVariables();
-initializeminiGameVariables();
\ No newline at end of file
+initializeminiGameVariables();
+initializeThirdGameVariables();
\ 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