User prompt
Yanana 5 tane yumurta olsun 5 den fazla yumurta olursa altta doğru uzasın yan yana en fazla 5 tane yumurta konulabilir
User prompt
Bütün yumurtaları ayıralım üste normal yumurtalar altta altın yumurtalar olsun
User prompt
Yeni 2 adet yumurta ekle 1. Yumurta fiyat 10000000 ama tabi yumurta 10M yazsın altında fiyat olarak içinde 3 tane pet olsun 1. Pet çıkma orani yüzde 0.5 ismi king tıklama basına 10000 veriyor 2. Pet İsmi knight çıkma orani yüzde 5 tıklama basına 5000 score veriyor 3. Pet ismi Human çıkma oranı 94.5 ihtimalle çıkıyor ve tıklama basına 2500 veriyor 2. Yumurta aynı diyeriylr ama altın hali fiyat 20M yazsın yani 20000000 para ama 20M yazssın içindekiler petler herşey aynı yüzde çıkma olasılığı ayni ama petlerin tıklama basına verdiği score lar 2 katı king tıklama basına 20000 verio 2. Pet altın knight 10000 score veriyor tıklama basına 3. Pet altın human tıklama başına 5000 score veriyor
User prompt
Yeni 2 yumurta ekle 1. Yumurta dış gornuş mor olsun ve dışında kolları olsun Fiyat 1250000 içimdekileri 3 tane pet 1. Pet çıkma oranı yüzde 1 Pet adı Iron man tıklama basına 500 versin 2. Pet çıkma oranı yüzde 14 isimkaptan Amerika tıklama basına 300 veriyor 3. Pet çıkma orani yüzde 85 pet adı spiderman tıklama basına 250 veriyor 2. Fiyat 2500000 Yumurta altın mor yumurta yine ayni petler var ama petler tıklama basına verdiği puanlar 2x katlansın çıkma oranları aynı 1. Pet iron man tıklama basına 1000 puan veriyor 2. Pet kaptan Amerika tıklama basına 600 veriyor 3. Pet spiderman tıklama basına 500 veriyor
User prompt
Yeni 2 yumurtanın ekle 1.yumurta dışı görünüşü kırmızı dinazorumsu olsun Fiyat 50000 içimde yüzde 5 ihtimalle T-rex çıksın bir tanesi tıklama basına 100 score versin 2. Pet velector yüzde 25 ihtimalle çıksın tıklama basına 80 veriyor 3. Pet titana boğa yüzde 70 ihtimalle çıkıyor tıklama basına 50 veriyor 2. Yumurtada yine ayni petler ama altın hali dış gornuş ayni ama altın hali fiyat 100000 yüzde 5 ihtimalle altın T-rex tıklama basına 200 score versin yüzde 25 ihtimalle altın velector tıklama basına 160 score veriyor yüzde 70 ihtimalle altın titana boğa tıklama basına 100 score veriyor
User prompt
Yeni bir yumurta ekle yumurtanın dış gornuşumu yeşil olsun ve içinde cıkan petler dinozor yüzde 5 ihtimalle çıkıyor 1 tane her tıklama basına +30 score veriyor 2 tane olunca 60 score veriyor 3 tane olunca 90 score veriyor 2. Pet yeşil yumurtadan çıkan ayı yüzde 15 ihtimalle çıkar 1 tane +20 puan veriyor 2 tane 40 puan 3 tane 60 puan tıklama basına diyer pet yüzde 80 ihtimalle arı çıkıyor 1 tanesi +10 score veriyor 2 tanesi 20 score 3 tane 30 score veriyor tıklama basına ve bu yumurtanın fiyat 15000 2. Yumurta aynı ama altın hali ve petler 2 katta tıklama basına gelen puanları 2x artsın yüzde cıkma ihtimalleri aynı sadece tıklama basına gelen olanlar 2x artır örn ayı +40 puan veriyor dinozor tıklama basına +60 veriyor 1 tanesi 1 tane arı +20 score veriyor ve yumurta fiyatı 30000
User prompt
Delete tuşuna basınca direk silinmesin Delete tuşuna bastıktan sonra pet üstüne tıklıyalım sonra Settar Delete tuşuna basalım sonrada silinsin
User prompt
Golden egg yerini değiştir normal egg yanına koy
User prompt
Invertory yazısını golden egg altına yerleştir
User prompt
Normal egg yanına golden egg ekle fiyatı 10000 para olsun ve içindekile altın cat yüzde 30 ihtimalle çıkıyor altın yılan yüzde 10 ihtimalle cıkıyor yüzde 60 ihtimalle altın dog cıkıyor altın dog her tıklama basına +3 tıklama borusu veriyor 2 tane altın dog +6 borusu veriyo tıklama basına 3 tane altın dog tıklama basına +9 score veriyor altın cat tıklama basına +6 puan veri altın cat 2 tane +12 score veriyor tıklama basına altım cat 3 tane +18 tıklama basına veriyor 1 tane altın yılan tıklama. Basına +10 score veriyor 2 altın yılan +20 score veriyor 3 altın yılan +30 score veriyor tıklama basına
User prompt
Egg fiyatı 1000 olsun
User prompt
Aynı petten sadece 3 tane takılabilir ve ayni oetş bidaha kullanmak için birdaha o peti çıkarman lazım 1 tane pet cıkarılcan 3 defa equip yapamadın ilakki 3 tane aynı petten cıkarılması lazım
User prompt
Aynı peti bidaha takmak için 1 defada aynı pet cıkarsın zorundasın
User prompt
Bir tane pet cıkarılımca ve onu equip yaptın takılsın ama bidaha equip yapında hicbirşey olmasın eyerki birdah o petten çıkarırsa ve yine equip yaparsan aynı oetten 2 tane takmış olursun
User prompt
Aynı peti bidaha takmak için 1 defada aynı pet cıkarsın zorundasın
User prompt
Shock wawe delete
User prompt
Ekrana dokununca beyaz şok dalgasını oluşsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ekrana tıklayınca şok dalgasını olmasın
User prompt
Ekrana tıklamdında beyaz şok dalgasını oluşsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ekrana her tıkladında şok dalgasını oluşsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Aynı petten en fazla 3 tane yapılabilir en gazlada toplam 3 tane pet takılabilir ve takılı olan bütün petler score ları ana score tıklamabasına gelen score eklensin
User prompt
Birden fazla aynı petten takarsan her peşlerinden tıklama basına gelen score puanı kaçtan pet varsa yinede eklensin
User prompt
İnvertıryden eyerki bir pet silmek istiyorsan unequip yanında dekte tuşu olsun ve ona bastında pet silinsin
User prompt
Eyer bir petten aynı petten bir daha takmak istiyorsa 2 tane pet equip yapmak istiyorsan bidaha o pett çıkman lazımdır
User prompt
Unequip class add
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2c3e50 // Dark blue-gray background }); /**** * Game Code ****/ // Reset all storage on game start storage.currentMultiplier = 1; storage.inventory = []; storage.equippedAnimals = []; // Global game variables var currentMultiplier = 1; var inventory = []; var isInventoryOpen = false; var inventoryOverlay = null; var equippedAnimals = []; var maxEquippedPets = 3; var fallingEgg = null; var eggClickCount = 0; var deleteMode = false; var selectedDeleteAnimalType = null; // Reset score to 0 on game start LK.setScore(0); // Initialize score display var scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); // Set score text properties scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Position score text with some padding from top scoreTxt.y = 100; // Add tap instruction text var instructionTxt = new Text2('Tap anywhere to score!', { size: 60, fill: 0xBDC3C7 }); instructionTxt.anchor.set(0.5, 0.5); instructionTxt.x = 2048 / 2; instructionTxt.y = 2732 / 2; game.addChild(instructionTxt); // Handle tap events on the game area game.down = function (x, y, obj) { // Calculate pet bonus based on equipped animal quantities var petBonus = 0; // Count each animal type var dogCount = 0; var catCount = 0; var snakeCount = 0; var goldenDogCount = 0; var goldenCatCount = 0; var goldenSnakeCount = 0; var dinosaurCount = 0; var bearCount = 0; var beeCount = 0; var goldenDinosaurCount = 0; var goldenBearCount = 0; var goldenBeeCount = 0; var trexCount = 0; var velectorCount = 0; var titanaBullCount = 0; var goldenTrexCount = 0; var goldenVelectorCount = 0; var goldenTitanaBullCount = 0; var ironManCount = 0; var captainAmericaCount = 0; var spidermanCount = 0; var goldenIronManCount = 0; var goldenCaptainAmericaCount = 0; var goldenSpidermanCount = 0; var kingCount = 0; var knightCount = 0; var humanCount = 0; var goldenKingCount = 0; var goldenKnightCount = 0; var goldenHumanCount = 0; for (var j = 0; j < equippedAnimals.length; j++) { if (equippedAnimals[j] === 'dog') { dogCount++; } else if (equippedAnimals[j] === 'cat') { catCount++; } else if (equippedAnimals[j] === 'snake') { snakeCount++; } else if (equippedAnimals[j] === 'goldenDog') { goldenDogCount++; } else if (equippedAnimals[j] === 'goldenCat') { goldenCatCount++; } else if (equippedAnimals[j] === 'goldenSnake') { goldenSnakeCount++; } else if (equippedAnimals[j] === 'dinosaur') { dinosaurCount++; } else if (equippedAnimals[j] === 'bear') { bearCount++; } else if (equippedAnimals[j] === 'bee') { beeCount++; } else if (equippedAnimals[j] === 'goldenDinosaur') { goldenDinosaurCount++; } else if (equippedAnimals[j] === 'goldenBear') { goldenBearCount++; } else if (equippedAnimals[j] === 'goldenBee') { goldenBeeCount++; } else if (equippedAnimals[j] === 'trex') { trexCount++; } else if (equippedAnimals[j] === 'velector') { velectorCount++; } else if (equippedAnimals[j] === 'titanaBull') { titanaBullCount++; } else if (equippedAnimals[j] === 'goldenTrex') { goldenTrexCount++; } else if (equippedAnimals[j] === 'goldenVelector') { goldenVelectorCount++; } else if (equippedAnimals[j] === 'goldenTitanaBull') { goldenTitanaBullCount++; } else if (equippedAnimals[j] === 'ironMan') { ironManCount++; } else if (equippedAnimals[j] === 'captainAmerica') { captainAmericaCount++; } else if (equippedAnimals[j] === 'spiderman') { spidermanCount++; } else if (equippedAnimals[j] === 'goldenIronMan') { goldenIronManCount++; } else if (equippedAnimals[j] === 'goldenCaptainAmerica') { goldenCaptainAmericaCount++; } else if (equippedAnimals[j] === 'goldenSpiderman') { goldenSpidermanCount++; } else if (equippedAnimals[j] === 'king') { kingCount++; } else if (equippedAnimals[j] === 'knight') { knightCount++; } else if (equippedAnimals[j] === 'human') { humanCount++; } else if (equippedAnimals[j] === 'goldenKing') { goldenKingCount++; } else if (equippedAnimals[j] === 'goldenKnight') { goldenKnightCount++; } else if (equippedAnimals[j] === 'goldenHuman') { goldenHumanCount++; } } // Each dog gives +1 bonus per tap petBonus += dogCount; // Cats: 1 cat = +2, 2 cats = +4, 3 cats = +6 (total bonus) if (catCount === 1) { petBonus += 2; } else if (catCount === 2) { petBonus += 4; } else if (catCount === 3) { petBonus += 6; } // Snakes: 1 snake = +5, 2 snakes = +10, 3 snakes = +15 (total bonus) if (snakeCount === 1) { petBonus += 5; } else if (snakeCount === 2) { petBonus += 10; } else if (snakeCount === 3) { petBonus += 15; } // Golden pets bonuses // Golden dogs: 1 = +3, 2 = +6, 3 = +9 per tap if (goldenDogCount === 1) { petBonus += 3; } else if (goldenDogCount === 2) { petBonus += 6; } else if (goldenDogCount === 3) { petBonus += 9; } // Golden cats: 1 = +6, 2 = +12, 3 = +18 per tap if (goldenCatCount === 1) { petBonus += 6; } else if (goldenCatCount === 2) { petBonus += 12; } else if (goldenCatCount === 3) { petBonus += 18; } // Golden snakes: 1 = +10, 2 = +20, 3 = +30 per tap if (goldenSnakeCount === 1) { petBonus += 10; } else if (goldenSnakeCount === 2) { petBonus += 20; } else if (goldenSnakeCount === 3) { petBonus += 30; } // Green egg pets bonuses // Dinosaurs: 1 = +30, 2 = +60, 3 = +90 per tap if (dinosaurCount === 1) { petBonus += 30; } else if (dinosaurCount === 2) { petBonus += 60; } else if (dinosaurCount === 3) { petBonus += 90; } // Bears: 1 = +20, 2 = +40, 3 = +60 per tap if (bearCount === 1) { petBonus += 20; } else if (bearCount === 2) { petBonus += 40; } else if (bearCount === 3) { petBonus += 60; } // Bees: 1 = +10, 2 = +20, 3 = +30 per tap if (beeCount === 1) { petBonus += 10; } else if (beeCount === 2) { petBonus += 20; } else if (beeCount === 3) { petBonus += 30; } // Golden green egg pets bonuses (2x multiplier) // Golden dinosaurs: 1 = +60, 2 = +120, 3 = +180 per tap if (goldenDinosaurCount === 1) { petBonus += 60; } else if (goldenDinosaurCount === 2) { petBonus += 120; } else if (goldenDinosaurCount === 3) { petBonus += 180; } // Golden bears: 1 = +40, 2 = +80, 3 = +120 per tap if (goldenBearCount === 1) { petBonus += 40; } else if (goldenBearCount === 2) { petBonus += 80; } else if (goldenBearCount === 3) { petBonus += 120; } // Golden bees: 1 = +20, 2 = +40, 3 = +60 per tap if (goldenBeeCount === 1) { petBonus += 20; } else if (goldenBeeCount === 2) { petBonus += 40; } else if (goldenBeeCount === 3) { petBonus += 60; } // Red egg pets bonuses // T-rex: 1 = +100, 2 = +200, 3 = +300 per tap if (trexCount === 1) { petBonus += 100; } else if (trexCount === 2) { petBonus += 200; } else if (trexCount === 3) { petBonus += 300; } // Velector: 1 = +80, 2 = +160, 3 = +240 per tap if (velectorCount === 1) { petBonus += 80; } else if (velectorCount === 2) { petBonus += 160; } else if (velectorCount === 3) { petBonus += 240; } // Titana Bull: 1 = +50, 2 = +100, 3 = +150 per tap if (titanaBullCount === 1) { petBonus += 50; } else if (titanaBullCount === 2) { petBonus += 100; } else if (titanaBullCount === 3) { petBonus += 150; } // Golden red egg pets bonuses // Golden T-rex: 1 = +200, 2 = +400, 3 = +600 per tap if (goldenTrexCount === 1) { petBonus += 200; } else if (goldenTrexCount === 2) { petBonus += 400; } else if (goldenTrexCount === 3) { petBonus += 600; } // Golden Velector: 1 = +160, 2 = +320, 3 = +480 per tap if (goldenVelectorCount === 1) { petBonus += 160; } else if (goldenVelectorCount === 2) { petBonus += 320; } else if (goldenVelectorCount === 3) { petBonus += 480; } // Golden Titana Bull: 1 = +100, 2 = +200, 3 = +300 per tap if (goldenTitanaBullCount === 1) { petBonus += 100; } else if (goldenTitanaBullCount === 2) { petBonus += 200; } else if (goldenTitanaBullCount === 3) { petBonus += 300; } // Purple egg pets bonuses // Iron Man: 1 = +500, 2 = +1000, 3 = +1500 per tap if (ironManCount === 1) { petBonus += 500; } else if (ironManCount === 2) { petBonus += 1000; } else if (ironManCount === 3) { petBonus += 1500; } // Captain America: 1 = +300, 2 = +600, 3 = +900 per tap if (captainAmericaCount === 1) { petBonus += 300; } else if (captainAmericaCount === 2) { petBonus += 600; } else if (captainAmericaCount === 3) { petBonus += 900; } // Spiderman: 1 = +250, 2 = +500, 3 = +750 per tap if (spidermanCount === 1) { petBonus += 250; } else if (spidermanCount === 2) { petBonus += 500; } else if (spidermanCount === 3) { petBonus += 750; } // Golden purple egg pets bonuses (2x multiplier) // Golden Iron Man: 1 = +1000, 2 = +2000, 3 = +3000 per tap if (goldenIronManCount === 1) { petBonus += 1000; } else if (goldenIronManCount === 2) { petBonus += 2000; } else if (goldenIronManCount === 3) { petBonus += 3000; } // Golden Captain America: 1 = +600, 2 = +1200, 3 = +1800 per tap if (goldenCaptainAmericaCount === 1) { petBonus += 600; } else if (goldenCaptainAmericaCount === 2) { petBonus += 1200; } else if (goldenCaptainAmericaCount === 3) { petBonus += 1800; } // Golden Spiderman: 1 = +500, 2 = +1000, 3 = +1500 per tap if (goldenSpidermanCount === 1) { petBonus += 500; } else if (goldenSpidermanCount === 2) { petBonus += 1000; } else if (goldenSpidermanCount === 3) { petBonus += 1500; } // White egg pets bonuses // King: 1 = +10000, 2 = +20000, 3 = +30000 per tap if (kingCount === 1) { petBonus += 10000; } else if (kingCount === 2) { petBonus += 20000; } else if (kingCount === 3) { petBonus += 30000; } // Knight: 1 = +5000, 2 = +10000, 3 = +15000 per tap if (knightCount === 1) { petBonus += 5000; } else if (knightCount === 2) { petBonus += 10000; } else if (knightCount === 3) { petBonus += 15000; } // Human: 1 = +2500, 2 = +5000, 3 = +7500 per tap if (humanCount === 1) { petBonus += 2500; } else if (humanCount === 2) { petBonus += 5000; } else if (humanCount === 3) { petBonus += 7500; } // Golden white egg pets bonuses (2x multiplier) // Golden King: 1 = +20000, 2 = +40000, 3 = +60000 per tap if (goldenKingCount === 1) { petBonus += 20000; } else if (goldenKingCount === 2) { petBonus += 40000; } else if (goldenKingCount === 3) { petBonus += 60000; } // Golden Knight: 1 = +10000, 2 = +20000, 3 = +30000 per tap if (goldenKnightCount === 1) { petBonus += 10000; } else if (goldenKnightCount === 2) { petBonus += 20000; } else if (goldenKnightCount === 3) { petBonus += 30000; } // Golden Human: 1 = +5000, 2 = +10000, 3 = +15000 per tap if (goldenHumanCount === 1) { petBonus += 5000; } else if (goldenHumanCount === 2) { petBonus += 10000; } else if (goldenHumanCount === 3) { petBonus += 15000; } // Base tap score is always 1, plus calculated pet bonus var totalScore = 1 + petBonus; LK.setScore(LK.getScore() + totalScore); // Update score display scoreTxt.setText(LK.getScore().toString()); // Create visual feedback at tap location showing total points gained var feedbackText = '+' + totalScore.toString(); var tapFeedback = new Text2(feedbackText, { size: 80, fill: 0x27AE60 }); tapFeedback.anchor.set(0.5, 0.5); tapFeedback.x = x; tapFeedback.y = y; tapFeedback.alpha = 1; game.addChild(tapFeedback); // Animate feedback text var startY = y; var animationDuration = 800; var startTime = Date.now(); var _animateCallback = function animateCallback() { var elapsed = Date.now() - startTime; var progress = elapsed / animationDuration; if (progress >= 1) { tapFeedback.destroy(); return; } // Move text upward and fade out tapFeedback.y = startY - progress * 100; tapFeedback.alpha = 1 - progress; LK.setTimeout(_animateCallback, 16); // ~60fps }; _animateCallback(); // Hide instruction text after first tap if (LK.getScore() === 1) { instructionTxt.alpha = 0; } }; // Add Shop button var shopBtn = new Text2('Shop', { size: 80, fill: 0xFFFFFF }); shopBtn.anchor.set(1, 0); LK.gui.topRight.addChild(shopBtn); shopBtn.x = -20; // Small padding from right edge shopBtn.y = 20; // Small padding from top // Shop interface state var isShopOpen = false; var shopOverlay = null; // Handle shop button tap shopBtn.down = function (x, y, obj) { if (!isShopOpen) { // Open shop - create black overlay using Container shopOverlay = new Container(); // Create black background shape for overlay var shopBackground = LK.getAsset('shopBg', { width: 2048, height: 2732, color: 0x000000, shape: 'box' }); shopOverlay.addChild(shopBackground); shopOverlay.x = 0; shopOverlay.y = 0; // Add egg item var eggItem = LK.getAsset('egg', { anchorX: 0.5, anchorY: 0.5 }); eggItem.x = 2048 / 2 - 300; eggItem.y = 800; shopOverlay.addChild(eggItem); // Add egg price text var eggPriceText = new Text2('1000 Score', { size: 60, fill: 0xFFFFFF }); eggPriceText.anchor.set(0.5, 0); eggPriceText.x = 2048 / 2 - 300; eggPriceText.y = 950; shopOverlay.addChild(eggPriceText); // Add golden egg item var goldenEggItem = LK.getAsset('goldenEgg', { anchorX: 0.5, anchorY: 0.5 }); goldenEggItem.x = 2048 / 2 + 300; goldenEggItem.y = 800; shopOverlay.addChild(goldenEggItem); // Add golden egg price text var goldenEggPriceText = new Text2('10000 Score', { size: 60, fill: 0xFFD700 }); goldenEggPriceText.anchor.set(0.5, 0); goldenEggPriceText.x = 2048 / 2 + 300; goldenEggPriceText.y = 950; shopOverlay.addChild(goldenEggPriceText); // Add green egg item var greenEggItem = LK.getAsset('greenEgg', { anchorX: 0.5, anchorY: 0.5 }); greenEggItem.x = 2048 / 2 - 300; greenEggItem.y = 1200; shopOverlay.addChild(greenEggItem); // Add green egg price text var greenEggPriceText = new Text2('15000 Score', { size: 60, fill: 0x00ff00 }); greenEggPriceText.anchor.set(0.5, 0); greenEggPriceText.x = 2048 / 2 - 300; greenEggPriceText.y = 1350; shopOverlay.addChild(greenEggPriceText); // Add golden green egg item var goldenGreenEggItem = LK.getAsset('goldenGreenEgg', { anchorX: 0.5, anchorY: 0.5 }); goldenGreenEggItem.x = 2048 / 2 + 300; goldenGreenEggItem.y = 1200; shopOverlay.addChild(goldenGreenEggItem); // Add golden green egg price text var goldenGreenEggPriceText = new Text2('30000 Score', { size: 60, fill: 0x90ee90 }); goldenGreenEggPriceText.anchor.set(0.5, 0); goldenGreenEggPriceText.x = 2048 / 2 + 300; goldenGreenEggPriceText.y = 1350; shopOverlay.addChild(goldenGreenEggPriceText); // Add red egg item var redEggItem = LK.getAsset('redEgg', { anchorX: 0.5, anchorY: 0.5 }); redEggItem.x = 2048 / 2 - 300; redEggItem.y = 1600; shopOverlay.addChild(redEggItem); // Add red egg price text var redEggPriceText = new Text2('50000 Score', { size: 60, fill: 0xff0000 }); redEggPriceText.anchor.set(0.5, 0); redEggPriceText.x = 2048 / 2 - 300; redEggPriceText.y = 1750; shopOverlay.addChild(redEggPriceText); // Add golden red egg item var goldenRedEggItem = LK.getAsset('goldenRedEgg', { anchorX: 0.5, anchorY: 0.5 }); goldenRedEggItem.x = 2048 / 2 + 300; goldenRedEggItem.y = 1600; shopOverlay.addChild(goldenRedEggItem); // Add golden red egg price text var goldenRedEggPriceText = new Text2('100000 Score', { size: 60, fill: 0xff6600 }); goldenRedEggPriceText.anchor.set(0.5, 0); goldenRedEggPriceText.x = 2048 / 2 + 300; goldenRedEggPriceText.y = 1750; shopOverlay.addChild(goldenRedEggPriceText); // Add purple egg item var purpleEggItem = LK.getAsset('purpleEgg', { anchorX: 0.5, anchorY: 0.5 }); purpleEggItem.x = 2048 / 2 - 300; purpleEggItem.y = 2000; shopOverlay.addChild(purpleEggItem); // Add purple egg price text var purpleEggPriceText = new Text2('1250000 Score', { size: 60, fill: 0x800080 }); purpleEggPriceText.anchor.set(0.5, 0); purpleEggPriceText.x = 2048 / 2 - 300; purpleEggPriceText.y = 2150; shopOverlay.addChild(purpleEggPriceText); // Add golden purple egg item var goldenPurpleEggItem = LK.getAsset('goldenPurpleEgg', { anchorX: 0.5, anchorY: 0.5 }); goldenPurpleEggItem.x = 2048 / 2 + 300; goldenPurpleEggItem.y = 2000; shopOverlay.addChild(goldenPurpleEggItem); // Add golden purple egg price text var goldenPurpleEggPriceText = new Text2('2500000 Score', { size: 60, fill: 0xdaa520 }); goldenPurpleEggPriceText.anchor.set(0.5, 0); goldenPurpleEggPriceText.x = 2048 / 2 + 300; goldenPurpleEggPriceText.y = 2150; shopOverlay.addChild(goldenPurpleEggPriceText); // Add white egg item var whiteEggItem = LK.getAsset('whiteEgg', { anchorX: 0.5, anchorY: 0.5 }); whiteEggItem.x = 2048 / 2 - 300; whiteEggItem.y = 2400; shopOverlay.addChild(whiteEggItem); // Add white egg price text var whiteEggPriceText = new Text2('10M', { size: 60, fill: 0xffffff }); whiteEggPriceText.anchor.set(0.5, 0); whiteEggPriceText.x = 2048 / 2 - 300; whiteEggPriceText.y = 2550; shopOverlay.addChild(whiteEggPriceText); // Add golden white egg item var goldenWhiteEggItem = LK.getAsset('goldenWhiteEgg', { anchorX: 0.5, anchorY: 0.5 }); goldenWhiteEggItem.x = 2048 / 2 + 300; goldenWhiteEggItem.y = 2400; shopOverlay.addChild(goldenWhiteEggItem); // Add golden white egg price text var goldenWhiteEggPriceText = new Text2('20M', { size: 60, fill: 0xffd700 }); goldenWhiteEggPriceText.anchor.set(0.5, 0); goldenWhiteEggPriceText.x = 2048 / 2 + 300; goldenWhiteEggPriceText.y = 2550; shopOverlay.addChild(goldenWhiteEggPriceText); // Add inventory button var inventoryBtn = new Text2('Inventory', { size: 80, fill: 0xFFFFFF }); inventoryBtn.anchor.set(0.5, 0); inventoryBtn.x = 2048 / 2; inventoryBtn.y = 2650; shopOverlay.addChild(inventoryBtn); // Handle egg purchase eggItem.down = function () { if (LK.getScore() >= 1000) { LK.setScore(LK.getScore() - 1000); scoreTxt.setText(LK.getScore().toString()); // Close shop shopOverlay.destroy(); shopOverlay = null; isShopOpen = false; // Create falling egg fallingEgg = LK.getAsset('egg', { anchorX: 0.5, anchorY: 0.5 }); fallingEgg.x = 2048 / 2; fallingEgg.y = -200; eggClickCount = 0; game.addChild(fallingEgg); // Animate egg falling tween(fallingEgg, { y: 2732 / 2 }, { duration: 1000 }); // Handle egg clicking fallingEgg.down = function () { eggClickCount++; if (eggClickCount === 1) { // First crack var crackedEgg1 = LK.getAsset('crackedEgg1', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg1.x = fallingEgg.x; crackedEgg1.y = fallingEgg.y; game.addChild(crackedEgg1); fallingEgg.destroy(); fallingEgg = crackedEgg1; fallingEgg.down = arguments.callee; } else if (eggClickCount === 2) { // Second crack var crackedEgg2 = LK.getAsset('crackedEgg2', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg2.x = fallingEgg.x; crackedEgg2.y = fallingEgg.y; game.addChild(crackedEgg2); fallingEgg.destroy(); fallingEgg = crackedEgg2; fallingEgg.down = arguments.callee; } else if (eggClickCount === 3) { // Third crack - almost fully cracked var crackedEgg3 = LK.getAsset('crackedEgg3', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg3.x = fallingEgg.x; crackedEgg3.y = fallingEgg.y; game.addChild(crackedEgg3); fallingEgg.destroy(); fallingEgg = crackedEgg3; fallingEgg.down = arguments.callee; } else if (eggClickCount === 4) { // Hatch the egg // Get list of animals that have less than 3 in inventory var availableAnimals = []; var animalTypes = ['dog', 'cat', 'snake']; for (var typeIndex = 0; typeIndex < animalTypes.length; typeIndex++) { var animalType = animalTypes[typeIndex]; var countInInventory = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === animalType) { countInInventory++; } } if (countInInventory < 3) { availableAnimals.push(animalType); } } var animal; if (availableAnimals.length > 0) { // Choose randomly from available animals var randomIndex = Math.floor(Math.random() * availableAnimals.length); animal = availableAnimals[randomIndex]; // Add to inventory inventory.push(animal); storage.inventory = inventory; } else { // All animal types have 3 in inventory, show message and don't give new pet animal = null; var allPetsText = new Text2('All pets maxed out!', { size: 60, fill: 0xff0000 }); allPetsText.anchor.set(0.5, 0.5); allPetsText.x = 2048 / 2; allPetsText.y = 1500; game.addChild(allPetsText); LK.setTimeout(function () { allPetsText.destroy(); }, 2000); } // Only show hatched animal if we got a new pet if (animal) { var animalSprite = LK.getAsset(animal, { anchorX: 0.5, anchorY: 0.5 }); animalSprite.x = fallingEgg.x; animalSprite.y = fallingEgg.y; game.addChild(animalSprite); // Remove animal after showing LK.setTimeout(function () { animalSprite.destroy(); }, 2000); } // Remove egg fallingEgg.destroy(); fallingEgg = null; } }; } }; // Handle green egg purchase greenEggItem.down = function () { if (LK.getScore() >= 15000) { LK.setScore(LK.getScore() - 15000); scoreTxt.setText(LK.getScore().toString()); // Close shop shopOverlay.destroy(); shopOverlay = null; isShopOpen = false; // Create falling green egg fallingEgg = LK.getAsset('greenEgg', { anchorX: 0.5, anchorY: 0.5 }); fallingEgg.x = 2048 / 2; fallingEgg.y = -200; eggClickCount = 0; game.addChild(fallingEgg); // Animate egg falling tween(fallingEgg, { y: 2732 / 2 }, { duration: 1000 }); // Handle green egg clicking fallingEgg.down = function () { eggClickCount++; if (eggClickCount === 1) { // First crack var crackedEgg1 = LK.getAsset('crackedEgg1', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg1.x = fallingEgg.x; crackedEgg1.y = fallingEgg.y; game.addChild(crackedEgg1); fallingEgg.destroy(); fallingEgg = crackedEgg1; fallingEgg.down = arguments.callee; } else if (eggClickCount === 2) { // Second crack var crackedEgg2 = LK.getAsset('crackedEgg2', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg2.x = fallingEgg.x; crackedEgg2.y = fallingEgg.y; game.addChild(crackedEgg2); fallingEgg.destroy(); fallingEgg = crackedEgg2; fallingEgg.down = arguments.callee; } else if (eggClickCount === 3) { // Third crack - almost fully cracked var crackedEgg3 = LK.getAsset('crackedEgg3', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg3.x = fallingEgg.x; crackedEgg3.y = fallingEgg.y; game.addChild(crackedEgg3); fallingEgg.destroy(); fallingEgg = crackedEgg3; fallingEgg.down = arguments.callee; } else if (eggClickCount === 4) { // Hatch the green egg with special probabilities var availableGreenAnimals = []; var greenAnimalTypes = ['dinosaur', 'bear', 'bee']; for (var typeIndex = 0; typeIndex < greenAnimalTypes.length; typeIndex++) { var animalType = greenAnimalTypes[typeIndex]; var countInInventory = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === animalType) { countInInventory++; } } if (countInInventory < 3) { availableGreenAnimals.push(animalType); } } var animal; if (availableGreenAnimals.length > 0) { // Special probability distribution for green eggs var random = Math.random(); var selectedAnimal; if (random < 0.05) { selectedAnimal = 'dinosaur'; // 5% chance } else if (random < 0.2) { selectedAnimal = 'bear'; // 15% chance } else { selectedAnimal = 'bee'; // 80% chance } // Check if selected animal is available if (availableGreenAnimals.indexOf(selectedAnimal) !== -1) { animal = selectedAnimal; } else { // If selected animal is not available, choose randomly from available var randomIndex = Math.floor(Math.random() * availableGreenAnimals.length); animal = availableGreenAnimals[randomIndex]; } inventory.push(animal); storage.inventory = inventory; } else { // All green animal types have 3 in inventory animal = null; var allGreenPetsText = new Text2('All green pets maxed out!', { size: 60, fill: 0xff0000 }); allGreenPetsText.anchor.set(0.5, 0.5); allGreenPetsText.x = 2048 / 2; allGreenPetsText.y = 1500; game.addChild(allGreenPetsText); LK.setTimeout(function () { allGreenPetsText.destroy(); }, 2000); } // Only show hatched animal if we got a new pet if (animal) { var animalSprite = LK.getAsset(animal, { anchorX: 0.5, anchorY: 0.5 }); animalSprite.x = fallingEgg.x; animalSprite.y = fallingEgg.y; game.addChild(animalSprite); // Remove animal after showing LK.setTimeout(function () { animalSprite.destroy(); }, 2000); } // Remove egg fallingEgg.destroy(); fallingEgg = null; } }; } }; // Handle golden green egg purchase goldenGreenEggItem.down = function () { if (LK.getScore() >= 30000) { LK.setScore(LK.getScore() - 30000); scoreTxt.setText(LK.getScore().toString()); // Close shop shopOverlay.destroy(); shopOverlay = null; isShopOpen = false; // Create falling golden green egg fallingEgg = LK.getAsset('goldenGreenEgg', { anchorX: 0.5, anchorY: 0.5 }); fallingEgg.x = 2048 / 2; fallingEgg.y = -200; eggClickCount = 0; game.addChild(fallingEgg); // Animate egg falling tween(fallingEgg, { y: 2732 / 2 }, { duration: 1000 }); // Handle golden green egg clicking fallingEgg.down = function () { eggClickCount++; if (eggClickCount === 1) { // First crack var crackedEgg1 = LK.getAsset('crackedEgg1', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg1.x = fallingEgg.x; crackedEgg1.y = fallingEgg.y; game.addChild(crackedEgg1); fallingEgg.destroy(); fallingEgg = crackedEgg1; fallingEgg.down = arguments.callee; } else if (eggClickCount === 2) { // Second crack var crackedEgg2 = LK.getAsset('crackedEgg2', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg2.x = fallingEgg.x; crackedEgg2.y = fallingEgg.y; game.addChild(crackedEgg2); fallingEgg.destroy(); fallingEgg = crackedEgg2; fallingEgg.down = arguments.callee; } else if (eggClickCount === 3) { // Third crack - almost fully cracked var crackedEgg3 = LK.getAsset('crackedEgg3', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg3.x = fallingEgg.x; crackedEgg3.y = fallingEgg.y; game.addChild(crackedEgg3); fallingEgg.destroy(); fallingEgg = crackedEgg3; fallingEgg.down = arguments.callee; } else if (eggClickCount === 4) { // Hatch the golden green egg with special probabilities var availableGoldenGreenAnimals = []; var goldenGreenAnimalTypes = ['goldenDinosaur', 'goldenBear', 'goldenBee']; for (var typeIndex = 0; typeIndex < goldenGreenAnimalTypes.length; typeIndex++) { var animalType = goldenGreenAnimalTypes[typeIndex]; var countInInventory = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === animalType) { countInInventory++; } } if (countInInventory < 3) { availableGoldenGreenAnimals.push(animalType); } } var animal; if (availableGoldenGreenAnimals.length > 0) { // Special probability distribution for golden green eggs (same as green) var random = Math.random(); var selectedAnimal; if (random < 0.05) { selectedAnimal = 'goldenDinosaur'; // 5% chance } else if (random < 0.2) { selectedAnimal = 'goldenBear'; // 15% chance } else { selectedAnimal = 'goldenBee'; // 80% chance } // Check if selected animal is available if (availableGoldenGreenAnimals.indexOf(selectedAnimal) !== -1) { animal = selectedAnimal; } else { // If selected animal is not available, choose randomly from available var randomIndex = Math.floor(Math.random() * availableGoldenGreenAnimals.length); animal = availableGoldenGreenAnimals[randomIndex]; } inventory.push(animal); storage.inventory = inventory; } else { // All golden green animal types have 3 in inventory animal = null; var allGoldenGreenPetsText = new Text2('All golden green pets maxed out!', { size: 60, fill: 0xff0000 }); allGoldenGreenPetsText.anchor.set(0.5, 0.5); allGoldenGreenPetsText.x = 2048 / 2; allGoldenGreenPetsText.y = 1500; game.addChild(allGoldenGreenPetsText); LK.setTimeout(function () { allGoldenGreenPetsText.destroy(); }, 2000); } // Only show hatched animal if we got a new pet if (animal) { var animalSprite = LK.getAsset(animal, { anchorX: 0.5, anchorY: 0.5 }); animalSprite.x = fallingEgg.x; animalSprite.y = fallingEgg.y; game.addChild(animalSprite); // Remove animal after showing LK.setTimeout(function () { animalSprite.destroy(); }, 2000); } // Remove egg fallingEgg.destroy(); fallingEgg = null; } }; } }; // Handle red egg purchase redEggItem.down = function () { if (LK.getScore() >= 50000) { LK.setScore(LK.getScore() - 50000); scoreTxt.setText(LK.getScore().toString()); // Close shop shopOverlay.destroy(); shopOverlay = null; isShopOpen = false; // Create falling red egg fallingEgg = LK.getAsset('redEgg', { anchorX: 0.5, anchorY: 0.5 }); fallingEgg.x = 2048 / 2; fallingEgg.y = -200; eggClickCount = 0; game.addChild(fallingEgg); // Animate egg falling tween(fallingEgg, { y: 2732 / 2 }, { duration: 1000 }); // Handle red egg clicking fallingEgg.down = function () { eggClickCount++; if (eggClickCount === 1) { // First crack var crackedEgg1 = LK.getAsset('crackedEgg1', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg1.x = fallingEgg.x; crackedEgg1.y = fallingEgg.y; game.addChild(crackedEgg1); fallingEgg.destroy(); fallingEgg = crackedEgg1; fallingEgg.down = arguments.callee; } else if (eggClickCount === 2) { // Second crack var crackedEgg2 = LK.getAsset('crackedEgg2', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg2.x = fallingEgg.x; crackedEgg2.y = fallingEgg.y; game.addChild(crackedEgg2); fallingEgg.destroy(); fallingEgg = crackedEgg2; fallingEgg.down = arguments.callee; } else if (eggClickCount === 3) { // Third crack - almost fully cracked var crackedEgg3 = LK.getAsset('crackedEgg3', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg3.x = fallingEgg.x; crackedEgg3.y = fallingEgg.y; game.addChild(crackedEgg3); fallingEgg.destroy(); fallingEgg = crackedEgg3; fallingEgg.down = arguments.callee; } else if (eggClickCount === 4) { // Hatch the red egg with special probabilities var availableRedAnimals = []; var redAnimalTypes = ['trex', 'velector', 'titanaBull']; for (var typeIndex = 0; typeIndex < redAnimalTypes.length; typeIndex++) { var animalType = redAnimalTypes[typeIndex]; var countInInventory = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === animalType) { countInInventory++; } } if (countInInventory < 3) { availableRedAnimals.push(animalType); } } var animal; if (availableRedAnimals.length > 0) { // Special probability distribution for red eggs var random = Math.random(); var selectedAnimal; if (random < 0.05) { selectedAnimal = 'trex'; // 5% chance } else if (random < 0.3) { selectedAnimal = 'velector'; // 25% chance } else { selectedAnimal = 'titanaBull'; // 70% chance } // Check if selected animal is available if (availableRedAnimals.indexOf(selectedAnimal) !== -1) { animal = selectedAnimal; } else { // If selected animal is not available, choose randomly from available var randomIndex = Math.floor(Math.random() * availableRedAnimals.length); animal = availableRedAnimals[randomIndex]; } inventory.push(animal); storage.inventory = inventory; } else { // All red animal types have 3 in inventory animal = null; var allRedPetsText = new Text2('All red pets maxed out!', { size: 60, fill: 0xff0000 }); allRedPetsText.anchor.set(0.5, 0.5); allRedPetsText.x = 2048 / 2; allRedPetsText.y = 1500; game.addChild(allRedPetsText); LK.setTimeout(function () { allRedPetsText.destroy(); }, 2000); } // Only show hatched animal if we got a new pet if (animal) { var animalSprite = LK.getAsset(animal, { anchorX: 0.5, anchorY: 0.5 }); animalSprite.x = fallingEgg.x; animalSprite.y = fallingEgg.y; game.addChild(animalSprite); // Remove animal after showing LK.setTimeout(function () { animalSprite.destroy(); }, 2000); } // Remove egg fallingEgg.destroy(); fallingEgg = null; } }; } }; // Handle golden red egg purchase goldenRedEggItem.down = function () { if (LK.getScore() >= 100000) { LK.setScore(LK.getScore() - 100000); scoreTxt.setText(LK.getScore().toString()); // Close shop shopOverlay.destroy(); shopOverlay = null; isShopOpen = false; // Create falling golden red egg fallingEgg = LK.getAsset('goldenRedEgg', { anchorX: 0.5, anchorY: 0.5 }); fallingEgg.x = 2048 / 2; fallingEgg.y = -200; eggClickCount = 0; game.addChild(fallingEgg); // Animate egg falling tween(fallingEgg, { y: 2732 / 2 }, { duration: 1000 }); // Handle golden red egg clicking fallingEgg.down = function () { eggClickCount++; if (eggClickCount === 1) { // First crack var crackedEgg1 = LK.getAsset('crackedEgg1', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg1.x = fallingEgg.x; crackedEgg1.y = fallingEgg.y; game.addChild(crackedEgg1); fallingEgg.destroy(); fallingEgg = crackedEgg1; fallingEgg.down = arguments.callee; } else if (eggClickCount === 2) { // Second crack var crackedEgg2 = LK.getAsset('crackedEgg2', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg2.x = fallingEgg.x; crackedEgg2.y = fallingEgg.y; game.addChild(crackedEgg2); fallingEgg.destroy(); fallingEgg = crackedEgg2; fallingEgg.down = arguments.callee; } else if (eggClickCount === 3) { // Third crack - almost fully cracked var crackedEgg3 = LK.getAsset('crackedEgg3', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg3.x = fallingEgg.x; crackedEgg3.y = fallingEgg.y; game.addChild(crackedEgg3); fallingEgg.destroy(); fallingEgg = crackedEgg3; fallingEgg.down = arguments.callee; } else if (eggClickCount === 4) { // Hatch the golden red egg with special probabilities var availableGoldenRedAnimals = []; var goldenRedAnimalTypes = ['goldenTrex', 'goldenVelector', 'goldenTitanaBull']; for (var typeIndex = 0; typeIndex < goldenRedAnimalTypes.length; typeIndex++) { var animalType = goldenRedAnimalTypes[typeIndex]; var countInInventory = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === animalType) { countInInventory++; } } if (countInInventory < 3) { availableGoldenRedAnimals.push(animalType); } } var animal; if (availableGoldenRedAnimals.length > 0) { // Special probability distribution for golden red eggs (same as red) var random = Math.random(); var selectedAnimal; if (random < 0.05) { selectedAnimal = 'goldenTrex'; // 5% chance } else if (random < 0.3) { selectedAnimal = 'goldenVelector'; // 25% chance } else { selectedAnimal = 'goldenTitanaBull'; // 70% chance } // Check if selected animal is available if (availableGoldenRedAnimals.indexOf(selectedAnimal) !== -1) { animal = selectedAnimal; } else { // If selected animal is not available, choose randomly from available var randomIndex = Math.floor(Math.random() * availableGoldenRedAnimals.length); animal = availableGoldenRedAnimals[randomIndex]; } inventory.push(animal); storage.inventory = inventory; } else { // All golden red animal types have 3 in inventory animal = null; var allGoldenRedPetsText = new Text2('All golden red pets maxed out!', { size: 60, fill: 0xff0000 }); allGoldenRedPetsText.anchor.set(0.5, 0.5); allGoldenRedPetsText.x = 2048 / 2; allGoldenRedPetsText.y = 1500; game.addChild(allGoldenRedPetsText); LK.setTimeout(function () { allGoldenRedPetsText.destroy(); }, 2000); } // Only show hatched animal if we got a new pet if (animal) { var animalSprite = LK.getAsset(animal, { anchorX: 0.5, anchorY: 0.5 }); animalSprite.x = fallingEgg.x; animalSprite.y = fallingEgg.y; game.addChild(animalSprite); // Remove animal after showing LK.setTimeout(function () { animalSprite.destroy(); }, 2000); } // Remove egg fallingEgg.destroy(); fallingEgg = null; } }; } }; // Handle purple egg purchase purpleEggItem.down = function () { if (LK.getScore() >= 1250000) { LK.setScore(LK.getScore() - 1250000); scoreTxt.setText(LK.getScore().toString()); // Close shop shopOverlay.destroy(); shopOverlay = null; isShopOpen = false; // Create falling purple egg fallingEgg = LK.getAsset('purpleEgg', { anchorX: 0.5, anchorY: 0.5 }); fallingEgg.x = 2048 / 2; fallingEgg.y = -200; eggClickCount = 0; game.addChild(fallingEgg); // Animate egg falling tween(fallingEgg, { y: 2732 / 2 }, { duration: 1000 }); // Handle purple egg clicking fallingEgg.down = function () { eggClickCount++; if (eggClickCount === 1) { // First crack var crackedEgg1 = LK.getAsset('crackedEgg1', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg1.x = fallingEgg.x; crackedEgg1.y = fallingEgg.y; game.addChild(crackedEgg1); fallingEgg.destroy(); fallingEgg = crackedEgg1; fallingEgg.down = arguments.callee; } else if (eggClickCount === 2) { // Second crack var crackedEgg2 = LK.getAsset('crackedEgg2', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg2.x = fallingEgg.x; crackedEgg2.y = fallingEgg.y; game.addChild(crackedEgg2); fallingEgg.destroy(); fallingEgg = crackedEgg2; fallingEgg.down = arguments.callee; } else if (eggClickCount === 3) { // Third crack - almost fully cracked var crackedEgg3 = LK.getAsset('crackedEgg3', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg3.x = fallingEgg.x; crackedEgg3.y = fallingEgg.y; game.addChild(crackedEgg3); fallingEgg.destroy(); fallingEgg = crackedEgg3; fallingEgg.down = arguments.callee; } else if (eggClickCount === 4) { // Hatch the purple egg with special probabilities var availablePurpleAnimals = []; var purpleAnimalTypes = ['ironMan', 'captainAmerica', 'spiderman']; for (var typeIndex = 0; typeIndex < purpleAnimalTypes.length; typeIndex++) { var animalType = purpleAnimalTypes[typeIndex]; var countInInventory = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === animalType) { countInInventory++; } } if (countInInventory < 3) { availablePurpleAnimals.push(animalType); } } var animal; if (availablePurpleAnimals.length > 0) { // Special probability distribution for purple eggs var random = Math.random(); var selectedAnimal; if (random < 0.01) { selectedAnimal = 'ironMan'; // 1% chance } else if (random < 0.15) { selectedAnimal = 'captainAmerica'; // 14% chance } else { selectedAnimal = 'spiderman'; // 85% chance } // Check if selected animal is available if (availablePurpleAnimals.indexOf(selectedAnimal) !== -1) { animal = selectedAnimal; } else { // If selected animal is not available, choose randomly from available var randomIndex = Math.floor(Math.random() * availablePurpleAnimals.length); animal = availablePurpleAnimals[randomIndex]; } inventory.push(animal); storage.inventory = inventory; } else { // All purple animal types have 3 in inventory animal = null; var allPurplePetsText = new Text2('All purple pets maxed out!', { size: 60, fill: 0xff0000 }); allPurplePetsText.anchor.set(0.5, 0.5); allPurplePetsText.x = 2048 / 2; allPurplePetsText.y = 1500; game.addChild(allPurplePetsText); LK.setTimeout(function () { allPurplePetsText.destroy(); }, 2000); } // Only show hatched animal if we got a new pet if (animal) { var animalSprite = LK.getAsset(animal, { anchorX: 0.5, anchorY: 0.5 }); animalSprite.x = fallingEgg.x; animalSprite.y = fallingEgg.y; game.addChild(animalSprite); // Remove animal after showing LK.setTimeout(function () { animalSprite.destroy(); }, 2000); } // Remove egg fallingEgg.destroy(); fallingEgg = null; } }; } }; // Handle golden purple egg purchase goldenPurpleEggItem.down = function () { if (LK.getScore() >= 2500000) { LK.setScore(LK.getScore() - 2500000); scoreTxt.setText(LK.getScore().toString()); // Close shop shopOverlay.destroy(); shopOverlay = null; isShopOpen = false; // Create falling golden purple egg fallingEgg = LK.getAsset('goldenPurpleEgg', { anchorX: 0.5, anchorY: 0.5 }); fallingEgg.x = 2048 / 2; fallingEgg.y = -200; eggClickCount = 0; game.addChild(fallingEgg); // Animate egg falling tween(fallingEgg, { y: 2732 / 2 }, { duration: 1000 }); // Handle golden purple egg clicking fallingEgg.down = function () { eggClickCount++; if (eggClickCount === 1) { // First crack var crackedEgg1 = LK.getAsset('crackedEgg1', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg1.x = fallingEgg.x; crackedEgg1.y = fallingEgg.y; game.addChild(crackedEgg1); fallingEgg.destroy(); fallingEgg = crackedEgg1; fallingEgg.down = arguments.callee; } else if (eggClickCount === 2) { // Second crack var crackedEgg2 = LK.getAsset('crackedEgg2', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg2.x = fallingEgg.x; crackedEgg2.y = fallingEgg.y; game.addChild(crackedEgg2); fallingEgg.destroy(); fallingEgg = crackedEgg2; fallingEgg.down = arguments.callee; } else if (eggClickCount === 3) { // Third crack - almost fully cracked var crackedEgg3 = LK.getAsset('crackedEgg3', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg3.x = fallingEgg.x; crackedEgg3.y = fallingEgg.y; game.addChild(crackedEgg3); fallingEgg.destroy(); fallingEgg = crackedEgg3; fallingEgg.down = arguments.callee; } else if (eggClickCount === 4) { // Hatch the golden purple egg with special probabilities var availableGoldenPurpleAnimals = []; var goldenPurpleAnimalTypes = ['goldenIronMan', 'goldenCaptainAmerica', 'goldenSpiderman']; for (var typeIndex = 0; typeIndex < goldenPurpleAnimalTypes.length; typeIndex++) { var animalType = goldenPurpleAnimalTypes[typeIndex]; var countInInventory = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === animalType) { countInInventory++; } } if (countInInventory < 3) { availableGoldenPurpleAnimals.push(animalType); } } var animal; if (availableGoldenPurpleAnimals.length > 0) { // Special probability distribution for golden purple eggs (same as purple) var random = Math.random(); var selectedAnimal; if (random < 0.01) { selectedAnimal = 'goldenIronMan'; // 1% chance } else if (random < 0.15) { selectedAnimal = 'goldenCaptainAmerica'; // 14% chance } else { selectedAnimal = 'goldenSpiderman'; // 85% chance } // Check if selected animal is available if (availableGoldenPurpleAnimals.indexOf(selectedAnimal) !== -1) { animal = selectedAnimal; } else { // If selected animal is not available, choose randomly from available var randomIndex = Math.floor(Math.random() * availableGoldenPurpleAnimals.length); animal = availableGoldenPurpleAnimals[randomIndex]; } inventory.push(animal); storage.inventory = inventory; } else { // All golden purple animal types have 3 in inventory animal = null; var allGoldenPurplePetsText = new Text2('All golden purple pets maxed out!', { size: 60, fill: 0xff0000 }); allGoldenPurplePetsText.anchor.set(0.5, 0.5); allGoldenPurplePetsText.x = 2048 / 2; allGoldenPurplePetsText.y = 1500; game.addChild(allGoldenPurplePetsText); LK.setTimeout(function () { allGoldenPurplePetsText.destroy(); }, 2000); } // Only show hatched animal if we got a new pet if (animal) { var animalSprite = LK.getAsset(animal, { anchorX: 0.5, anchorY: 0.5 }); animalSprite.x = fallingEgg.x; animalSprite.y = fallingEgg.y; game.addChild(animalSprite); // Remove animal after showing LK.setTimeout(function () { animalSprite.destroy(); }, 2000); } // Remove egg fallingEgg.destroy(); fallingEgg = null; } }; } }; // Handle white egg purchase whiteEggItem.down = function () { if (LK.getScore() >= 10000000) { LK.setScore(LK.getScore() - 10000000); scoreTxt.setText(LK.getScore().toString()); // Close shop shopOverlay.destroy(); shopOverlay = null; isShopOpen = false; // Create falling white egg fallingEgg = LK.getAsset('whiteEgg', { anchorX: 0.5, anchorY: 0.5 }); fallingEgg.x = 2048 / 2; fallingEgg.y = -200; eggClickCount = 0; game.addChild(fallingEgg); // Animate egg falling tween(fallingEgg, { y: 2732 / 2 }, { duration: 1000 }); // Handle white egg clicking fallingEgg.down = function () { eggClickCount++; if (eggClickCount === 1) { // First crack var crackedEgg1 = LK.getAsset('crackedEgg1', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg1.x = fallingEgg.x; crackedEgg1.y = fallingEgg.y; game.addChild(crackedEgg1); fallingEgg.destroy(); fallingEgg = crackedEgg1; fallingEgg.down = arguments.callee; } else if (eggClickCount === 2) { // Second crack var crackedEgg2 = LK.getAsset('crackedEgg2', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg2.x = fallingEgg.x; crackedEgg2.y = fallingEgg.y; game.addChild(crackedEgg2); fallingEgg.destroy(); fallingEgg = crackedEgg2; fallingEgg.down = arguments.callee; } else if (eggClickCount === 3) { // Third crack - almost fully cracked var crackedEgg3 = LK.getAsset('crackedEgg3', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg3.x = fallingEgg.x; crackedEgg3.y = fallingEgg.y; game.addChild(crackedEgg3); fallingEgg.destroy(); fallingEgg = crackedEgg3; fallingEgg.down = arguments.callee; } else if (eggClickCount === 4) { // Hatch the white egg with special probabilities var availableWhiteAnimals = []; var whiteAnimalTypes = ['king', 'knight', 'human']; for (var typeIndex = 0; typeIndex < whiteAnimalTypes.length; typeIndex++) { var animalType = whiteAnimalTypes[typeIndex]; var countInInventory = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === animalType) { countInInventory++; } } if (countInInventory < 3) { availableWhiteAnimals.push(animalType); } } var animal; if (availableWhiteAnimals.length > 0) { // Special probability distribution for white eggs var random = Math.random(); var selectedAnimal; if (random < 0.005) { selectedAnimal = 'king'; // 0.5% chance } else if (random < 0.055) { selectedAnimal = 'knight'; // 5% chance } else { selectedAnimal = 'human'; // 94.5% chance } // Check if selected animal is available if (availableWhiteAnimals.indexOf(selectedAnimal) !== -1) { animal = selectedAnimal; } else { // If selected animal is not available, choose randomly from available var randomIndex = Math.floor(Math.random() * availableWhiteAnimals.length); animal = availableWhiteAnimals[randomIndex]; } inventory.push(animal); storage.inventory = inventory; } else { // All white animal types have 3 in inventory animal = null; var allWhitePetsText = new Text2('All white pets maxed out!', { size: 60, fill: 0xff0000 }); allWhitePetsText.anchor.set(0.5, 0.5); allWhitePetsText.x = 2048 / 2; allWhitePetsText.y = 1500; game.addChild(allWhitePetsText); LK.setTimeout(function () { allWhitePetsText.destroy(); }, 2000); } // Only show hatched animal if we got a new pet if (animal) { var animalSprite = LK.getAsset(animal, { anchorX: 0.5, anchorY: 0.5 }); animalSprite.x = fallingEgg.x; animalSprite.y = fallingEgg.y; game.addChild(animalSprite); // Remove animal after showing LK.setTimeout(function () { animalSprite.destroy(); }, 2000); } // Remove egg fallingEgg.destroy(); fallingEgg = null; } }; } }; // Handle golden white egg purchase goldenWhiteEggItem.down = function () { if (LK.getScore() >= 20000000) { LK.setScore(LK.getScore() - 20000000); scoreTxt.setText(LK.getScore().toString()); // Close shop shopOverlay.destroy(); shopOverlay = null; isShopOpen = false; // Create falling golden white egg fallingEgg = LK.getAsset('goldenWhiteEgg', { anchorX: 0.5, anchorY: 0.5 }); fallingEgg.x = 2048 / 2; fallingEgg.y = -200; eggClickCount = 0; game.addChild(fallingEgg); // Animate egg falling tween(fallingEgg, { y: 2732 / 2 }, { duration: 1000 }); // Handle golden white egg clicking fallingEgg.down = function () { eggClickCount++; if (eggClickCount === 1) { // First crack var crackedEgg1 = LK.getAsset('crackedEgg1', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg1.x = fallingEgg.x; crackedEgg1.y = fallingEgg.y; game.addChild(crackedEgg1); fallingEgg.destroy(); fallingEgg = crackedEgg1; fallingEgg.down = arguments.callee; } else if (eggClickCount === 2) { // Second crack var crackedEgg2 = LK.getAsset('crackedEgg2', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg2.x = fallingEgg.x; crackedEgg2.y = fallingEgg.y; game.addChild(crackedEgg2); fallingEgg.destroy(); fallingEgg = crackedEgg2; fallingEgg.down = arguments.callee; } else if (eggClickCount === 3) { // Third crack - almost fully cracked var crackedEgg3 = LK.getAsset('crackedEgg3', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg3.x = fallingEgg.x; crackedEgg3.y = fallingEgg.y; game.addChild(crackedEgg3); fallingEgg.destroy(); fallingEgg = crackedEgg3; fallingEgg.down = arguments.callee; } else if (eggClickCount === 4) { // Hatch the golden white egg with special probabilities var availableGoldenWhiteAnimals = []; var goldenWhiteAnimalTypes = ['goldenKing', 'goldenKnight', 'goldenHuman']; for (var typeIndex = 0; typeIndex < goldenWhiteAnimalTypes.length; typeIndex++) { var animalType = goldenWhiteAnimalTypes[typeIndex]; var countInInventory = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === animalType) { countInInventory++; } } if (countInInventory < 3) { availableGoldenWhiteAnimals.push(animalType); } } var animal; if (availableGoldenWhiteAnimals.length > 0) { // Special probability distribution for golden white eggs (same as white) var random = Math.random(); var selectedAnimal; if (random < 0.005) { selectedAnimal = 'goldenKing'; // 0.5% chance } else if (random < 0.055) { selectedAnimal = 'goldenKnight'; // 5% chance } else { selectedAnimal = 'goldenHuman'; // 94.5% chance } // Check if selected animal is available if (availableGoldenWhiteAnimals.indexOf(selectedAnimal) !== -1) { animal = selectedAnimal; } else { // If selected animal is not available, choose randomly from available var randomIndex = Math.floor(Math.random() * availableGoldenWhiteAnimals.length); animal = availableGoldenWhiteAnimals[randomIndex]; } inventory.push(animal); storage.inventory = inventory; } else { // All golden white animal types have 3 in inventory animal = null; var allGoldenWhitePetsText = new Text2('All golden white pets maxed out!', { size: 60, fill: 0xff0000 }); allGoldenWhitePetsText.anchor.set(0.5, 0.5); allGoldenWhitePetsText.x = 2048 / 2; allGoldenWhitePetsText.y = 1500; game.addChild(allGoldenWhitePetsText); LK.setTimeout(function () { allGoldenWhitePetsText.destroy(); }, 2000); } // Only show hatched animal if we got a new pet if (animal) { var animalSprite = LK.getAsset(animal, { anchorX: 0.5, anchorY: 0.5 }); animalSprite.x = fallingEgg.x; animalSprite.y = fallingEgg.y; game.addChild(animalSprite); // Remove animal after showing LK.setTimeout(function () { animalSprite.destroy(); }, 2000); } // Remove egg fallingEgg.destroy(); fallingEgg = null; } }; } }; // Handle golden egg purchase goldenEggItem.down = function () { if (LK.getScore() >= 10000) { LK.setScore(LK.getScore() - 10000); scoreTxt.setText(LK.getScore().toString()); // Close shop shopOverlay.destroy(); shopOverlay = null; isShopOpen = false; // Create falling golden egg fallingEgg = LK.getAsset('goldenEgg', { anchorX: 0.5, anchorY: 0.5 }); fallingEgg.x = 2048 / 2; fallingEgg.y = -200; eggClickCount = 0; game.addChild(fallingEgg); // Animate egg falling tween(fallingEgg, { y: 2732 / 2 }, { duration: 1000 }); // Handle golden egg clicking fallingEgg.down = function () { eggClickCount++; if (eggClickCount === 1) { // First crack var crackedEgg1 = LK.getAsset('crackedEgg1', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg1.x = fallingEgg.x; crackedEgg1.y = fallingEgg.y; game.addChild(crackedEgg1); fallingEgg.destroy(); fallingEgg = crackedEgg1; fallingEgg.down = arguments.callee; } else if (eggClickCount === 2) { // Second crack var crackedEgg2 = LK.getAsset('crackedEgg2', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg2.x = fallingEgg.x; crackedEgg2.y = fallingEgg.y; game.addChild(crackedEgg2); fallingEgg.destroy(); fallingEgg = crackedEgg2; fallingEgg.down = arguments.callee; } else if (eggClickCount === 3) { // Third crack - almost fully cracked var crackedEgg3 = LK.getAsset('crackedEgg3', { anchorX: 0.5, anchorY: 0.5 }); crackedEgg3.x = fallingEgg.x; crackedEgg3.y = fallingEgg.y; game.addChild(crackedEgg3); fallingEgg.destroy(); fallingEgg = crackedEgg3; fallingEgg.down = arguments.callee; } else if (eggClickCount === 4) { // Hatch the golden egg with special probabilities var availableGoldenAnimals = []; var goldenAnimalTypes = ['goldenDog', 'goldenCat', 'goldenSnake']; for (var typeIndex = 0; typeIndex < goldenAnimalTypes.length; typeIndex++) { var animalType = goldenAnimalTypes[typeIndex]; var countInInventory = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === animalType) { countInInventory++; } } if (countInInventory < 3) { availableGoldenAnimals.push(animalType); } } var animal; if (availableGoldenAnimals.length > 0) { // Special probability distribution for golden eggs var random = Math.random(); var selectedAnimal; if (random < 0.6) { selectedAnimal = 'goldenDog'; // 60% chance } else if (random < 0.9) { selectedAnimal = 'goldenCat'; // 30% chance } else { selectedAnimal = 'goldenSnake'; // 10% chance } // Check if selected animal is available if (availableGoldenAnimals.indexOf(selectedAnimal) !== -1) { animal = selectedAnimal; } else { // If selected animal is not available, choose randomly from available var randomIndex = Math.floor(Math.random() * availableGoldenAnimals.length); animal = availableGoldenAnimals[randomIndex]; } inventory.push(animal); storage.inventory = inventory; } else { // All golden animal types have 3 in inventory animal = null; var allGoldenPetsText = new Text2('All golden pets maxed out!', { size: 60, fill: 0xff0000 }); allGoldenPetsText.anchor.set(0.5, 0.5); allGoldenPetsText.x = 2048 / 2; allGoldenPetsText.y = 1500; game.addChild(allGoldenPetsText); LK.setTimeout(function () { allGoldenPetsText.destroy(); }, 2000); } // Only show hatched animal if we got a new pet if (animal) { var animalSprite = LK.getAsset(animal, { anchorX: 0.5, anchorY: 0.5 }); animalSprite.x = fallingEgg.x; animalSprite.y = fallingEgg.y; game.addChild(animalSprite); // Remove animal after showing LK.setTimeout(function () { animalSprite.destroy(); }, 2000); } // Remove egg fallingEgg.destroy(); fallingEgg = null; } }; } }; // Handle inventory button inventoryBtn.down = function () { if (!isInventoryOpen) { // Close shop first if (shopOverlay) { shopOverlay.destroy(); } shopOverlay = null; isShopOpen = false; // Open inventory isInventoryOpen = true; inventoryOverlay = new Container(); var invBackground = LK.getAsset('shopBg', { width: 2048, height: 2732, color: 0x000000, shape: 'box' }); inventoryOverlay.addChild(invBackground); game.addChild(inventoryOverlay); // Display inventory items by unique pet types var yPos = 300; var uniqueTypes = []; var animalTypes = ['dog', 'cat', 'snake', 'goldenDog', 'goldenCat', 'goldenSnake', 'dinosaur', 'bear', 'bee', 'goldenDinosaur', 'goldenBear', 'goldenBee', 'trex', 'velector', 'titanaBull', 'goldenTrex', 'goldenVelector', 'goldenTitanaBull', 'ironMan', 'captainAmerica', 'spiderman', 'goldenIronMan', 'goldenCaptainAmerica', 'goldenSpiderman', 'king', 'knight', 'human', 'goldenKing', 'goldenKnight', 'goldenHuman']; for (var typeIndex = 0; typeIndex < animalTypes.length; typeIndex++) { var animalType = animalTypes[typeIndex]; var countInInventory = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === animalType) { countInInventory++; } } if (countInInventory > 0) { uniqueTypes.push({ type: animalType, count: countInInventory }); } } for (var i = 0; i < uniqueTypes.length; i++) { var petData = uniqueTypes[i]; var animalItem = LK.getAsset(petData.type, { anchorX: 0.5, anchorY: 0.5 }); animalItem.x = 300; animalItem.y = yPos; animalItem.animalType = petData.type; animalItem.inventoryIndex = i; inventoryOverlay.addChild(animalItem); // Handle pet deletion when in delete mode animalItem.down = function () { if (deleteMode && selectedDeleteAnimalType === this.animalType) { // Delete the pet // Remove one instance of this pet from inventory for (var removeIndex = 0; removeIndex < inventory.length; removeIndex++) { if (inventory[removeIndex] === this.animalType) { inventory.splice(removeIndex, 1); break; } } storage.inventory = inventory; // Also remove from equipped animals if it was equipped for (var removeIndex = equippedAnimals.length - 1; removeIndex >= 0; removeIndex--) { if (equippedAnimals[removeIndex] === this.animalType) { equippedAnimals.splice(removeIndex, 1); break; } } // Recalculate pet bonus after removing var petBonus = 0; // Count each animal type var dogCount = 0; var catCount = 0; var snakeCount = 0; for (var j = 0; j < equippedAnimals.length; j++) { if (equippedAnimals[j] === 'dog') { dogCount++; } else if (equippedAnimals[j] === 'cat') { catCount++; } else if (equippedAnimals[j] === 'snake') { snakeCount++; } } // Each dog gives +1 bonus per tap petBonus += dogCount; // Cats: 1 cat = +2, 2 cats = +4, 3 cats = +6 (total bonus) if (catCount === 1) { petBonus += 2; } else if (catCount === 2) { petBonus += 4; } else if (catCount === 3) { petBonus += 6; } // Snakes: 1 snake = +5, 2 snakes = +10, 3 snakes = +15 (total bonus) if (snakeCount === 1) { petBonus += 5; } else if (snakeCount === 2) { petBonus += 10; } else if (snakeCount === 3) { petBonus += 15; } // Store as multiplier format (base 1 + bonus) currentMultiplier = 1 + petBonus; storage.equippedAnimals = equippedAnimals; storage.currentMultiplier = currentMultiplier; // Exit delete mode deleteMode = false; selectedDeleteAnimalType = null; // Close and reopen inventory to refresh display inventoryOverlay.destroy(); inventoryOverlay = null; isInventoryOpen = false; // Reopen inventory to show updated counts inventoryBtn.down(); } }; // Count how many of this type are equipped var equippedCount = 0; for (var k = 0; k < equippedAnimals.length; k++) { if (equippedAnimals[k] === petData.type) { equippedCount++; } } // Add equip button var equipBtn = new Text2('Equip', { size: 50, fill: 0xFFFFFF }); equipBtn.anchor.set(0.5, 0.5); equipBtn.x = 550; equipBtn.y = yPos; equipBtn.animalType = inventory[i]; equipBtn.inventoryIndex = i; inventoryOverlay.addChild(equipBtn); // Add unequip button var unequipBtn = new Text2('Unequip', { size: 50, fill: 0xFF6B6B }); unequipBtn.anchor.set(0.5, 0.5); unequipBtn.x = 700; unequipBtn.y = yPos; unequipBtn.animalType = inventory[i]; unequipBtn.inventoryIndex = i; inventoryOverlay.addChild(unequipBtn); // Add delete button var deleteBtn = new Text2('Delete', { size: 50, fill: 0xFF0000 }); deleteBtn.anchor.set(0.5, 0.5); deleteBtn.x = 850; deleteBtn.y = yPos; deleteBtn.animalType = inventory[i]; deleteBtn.inventoryIndex = i; inventoryOverlay.addChild(deleteBtn); // Add count display var countText = new Text2('Owned: ' + petData.count + ' | Equipped: ' + equippedCount, { size: 40, fill: 0xFFFFFF }); countText.anchor.set(0.5, 0.5); countText.x = 1000; countText.y = yPos; inventoryOverlay.addChild(countText); // Handle delete functionality deleteBtn.down = function () { if (!deleteMode) { // First press - enter delete mode deleteMode = true; selectedDeleteAnimalType = this.animalType; // Show message to click on pet var deleteInstructionText = new Text2('Click on the pet to delete it', { size: 40, fill: 0xff0000 }); deleteInstructionText.anchor.set(0.5, 0.5); deleteInstructionText.x = 2048 / 2; deleteInstructionText.y = 2500; inventoryOverlay.addChild(deleteInstructionText); // Auto-hide instruction after 3 seconds LK.setTimeout(function () { if (deleteInstructionText && deleteInstructionText.parent) { deleteInstructionText.destroy(); } }, 3000); } else if (deleteMode && selectedDeleteAnimalType === this.animalType) { // Second press on same delete button - cancel delete mode deleteMode = false; selectedDeleteAnimalType = null; } }; // Handle unequip functionality unequipBtn.down = function () { // Find and remove one instance of this pet type from equipped animals for (var removeIndex = 0; removeIndex < equippedAnimals.length; removeIndex++) { if (equippedAnimals[removeIndex] === this.animalType) { equippedAnimals.splice(removeIndex, 1); break; } } // Recalculate pet bonus after unequipping var petBonus = 0; // Count each animal type var dogCount = 0; var catCount = 0; var snakeCount = 0; for (var j = 0; j < equippedAnimals.length; j++) { if (equippedAnimals[j] === 'dog') { dogCount++; } else if (equippedAnimals[j] === 'cat') { catCount++; } else if (equippedAnimals[j] === 'snake') { snakeCount++; } } // Each dog gives +1 bonus per tap petBonus += dogCount; // Cats: 1 cat = +2, 2 cats = +4, 3 cats = +6 (total bonus) if (catCount === 1) { petBonus += 2; } else if (catCount === 2) { petBonus += 4; } else if (catCount === 3) { petBonus += 6; } // Snakes: 1 snake = +5, 2 snakes = +10, 3 snakes = +15 (total bonus) if (snakeCount === 1) { petBonus += 5; } else if (snakeCount === 2) { petBonus += 10; } else if (snakeCount === 3) { petBonus += 15; } // Store as multiplier format (base 1 + bonus) currentMultiplier = 1 + petBonus; storage.equippedAnimals = equippedAnimals; storage.currentMultiplier = currentMultiplier; // Close and reopen inventory to refresh display inventoryOverlay.destroy(); inventoryOverlay = null; isInventoryOpen = false; // Reopen inventory to show updated counts inventoryBtn.down(); }; equipBtn.down = function () { // Count how many of this pet type are in inventory var inventoryCount = 0; for (var invIndex = 0; invIndex < inventory.length; invIndex++) { if (inventory[invIndex] === this.animalType) { inventoryCount++; } } // Count how many of this pet type are already equipped var equippedCount = 0; for (var checkIndex = 0; checkIndex < equippedAnimals.length; checkIndex++) { if (equippedAnimals[checkIndex] === this.animalType) { equippedCount++; } } // Check if we have this pet available in inventory to equip if (equippedCount >= inventoryCount) { var noPetText = new Text2('Need more pets to equip!', { size: 40, fill: 0xff0000 }); noPetText.anchor.set(0.5, 0.5); noPetText.x = this.x; noPetText.y = this.y - 50; inventoryOverlay.addChild(noPetText); LK.setTimeout(function () { noPetText.destroy(); }, 1500); return; } // Check if we can equip more pets (total limit of 3) if (equippedAnimals.length < maxEquippedPets) { // Equip this pet equippedAnimals.push(this.animalType); } else { // Show message that max pets reached var maxText = new Text2('Max 3 pets total!', { size: 40, fill: 0xff0000 }); maxText.anchor.set(0.5, 0.5); maxText.x = this.x; maxText.y = this.y - 50; inventoryOverlay.addChild(maxText); LK.setTimeout(function () { maxText.destroy(); }, 1500); return; } // Calculate pet bonus based on equipped animal quantities var petBonus = 0; // Count each animal type var dogCount = 0; var catCount = 0; var snakeCount = 0; for (var j = 0; j < equippedAnimals.length; j++) { if (equippedAnimals[j] === 'dog') { dogCount++; } else if (equippedAnimals[j] === 'cat') { catCount++; } else if (equippedAnimals[j] === 'snake') { snakeCount++; } } // Each dog gives +1 bonus per tap petBonus += dogCount; // Cats: 1 cat = +2, 2 cats = +4, 3 cats = +6 (total bonus) if (catCount === 1) { petBonus += 2; } else if (catCount === 2) { petBonus += 4; } else if (catCount === 3) { petBonus += 6; } // Snakes: 1 snake = +5, 2 snakes = +10, 3 snakes = +15 (total bonus) if (snakeCount === 1) { petBonus += 5; } else if (snakeCount === 2) { petBonus += 10; } else if (snakeCount === 3) { petBonus += 15; } // Store as multiplier format (base 1 + bonus) currentMultiplier = 1 + petBonus; storage.equippedAnimals = equippedAnimals; storage.currentMultiplier = currentMultiplier; // Close and reopen inventory to refresh display inventoryOverlay.destroy(); inventoryOverlay = null; isInventoryOpen = false; // Reopen inventory to show updated counts inventoryBtn.down(); }; yPos += 200; } // Add close inventory button var closeInvBtn = new Text2('Close', { size: 80, fill: 0xFFFFFF }); closeInvBtn.anchor.set(0.5, 0.5); closeInvBtn.x = 2048 / 2; closeInvBtn.y = 2400; inventoryOverlay.addChild(closeInvBtn); closeInvBtn.down = function () { // Reset delete mode when closing inventory deleteMode = false; selectedDeleteAnimalType = null; inventoryOverlay.destroy(); inventoryOverlay = null; isInventoryOpen = false; }; } }; // Add shop overlay to main game game.addChild(shopOverlay); isShopOpen = true; } else { // Close shop - remove overlay if (shopOverlay) { shopOverlay.destroy(); shopOverlay = null; } isShopOpen = false; } }; // Update score display on game start game.update = function () { // Keep score text updated (in case it changes from other sources) scoreTxt.setText(LK.getScore().toString()); };
===================================================================
--- original.js
+++ change.js
@@ -78,8 +78,14 @@
var spidermanCount = 0;
var goldenIronManCount = 0;
var goldenCaptainAmericaCount = 0;
var goldenSpidermanCount = 0;
+ var kingCount = 0;
+ var knightCount = 0;
+ var humanCount = 0;
+ var goldenKingCount = 0;
+ var goldenKnightCount = 0;
+ var goldenHumanCount = 0;
for (var j = 0; j < equippedAnimals.length; j++) {
if (equippedAnimals[j] === 'dog') {
dogCount++;
} else if (equippedAnimals[j] === 'cat') {
@@ -127,8 +133,20 @@
} else if (equippedAnimals[j] === 'goldenCaptainAmerica') {
goldenCaptainAmericaCount++;
} else if (equippedAnimals[j] === 'goldenSpiderman') {
goldenSpidermanCount++;
+ } else if (equippedAnimals[j] === 'king') {
+ kingCount++;
+ } else if (equippedAnimals[j] === 'knight') {
+ knightCount++;
+ } else if (equippedAnimals[j] === 'human') {
+ humanCount++;
+ } else if (equippedAnimals[j] === 'goldenKing') {
+ goldenKingCount++;
+ } else if (equippedAnimals[j] === 'goldenKnight') {
+ goldenKnightCount++;
+ } else if (equippedAnimals[j] === 'goldenHuman') {
+ goldenHumanCount++;
}
}
// Each dog gives +1 bonus per tap
petBonus += dogCount;
@@ -322,8 +340,58 @@
petBonus += 1000;
} else if (goldenSpidermanCount === 3) {
petBonus += 1500;
}
+ // White egg pets bonuses
+ // King: 1 = +10000, 2 = +20000, 3 = +30000 per tap
+ if (kingCount === 1) {
+ petBonus += 10000;
+ } else if (kingCount === 2) {
+ petBonus += 20000;
+ } else if (kingCount === 3) {
+ petBonus += 30000;
+ }
+ // Knight: 1 = +5000, 2 = +10000, 3 = +15000 per tap
+ if (knightCount === 1) {
+ petBonus += 5000;
+ } else if (knightCount === 2) {
+ petBonus += 10000;
+ } else if (knightCount === 3) {
+ petBonus += 15000;
+ }
+ // Human: 1 = +2500, 2 = +5000, 3 = +7500 per tap
+ if (humanCount === 1) {
+ petBonus += 2500;
+ } else if (humanCount === 2) {
+ petBonus += 5000;
+ } else if (humanCount === 3) {
+ petBonus += 7500;
+ }
+ // Golden white egg pets bonuses (2x multiplier)
+ // Golden King: 1 = +20000, 2 = +40000, 3 = +60000 per tap
+ if (goldenKingCount === 1) {
+ petBonus += 20000;
+ } else if (goldenKingCount === 2) {
+ petBonus += 40000;
+ } else if (goldenKingCount === 3) {
+ petBonus += 60000;
+ }
+ // Golden Knight: 1 = +10000, 2 = +20000, 3 = +30000 per tap
+ if (goldenKnightCount === 1) {
+ petBonus += 10000;
+ } else if (goldenKnightCount === 2) {
+ petBonus += 20000;
+ } else if (goldenKnightCount === 3) {
+ petBonus += 30000;
+ }
+ // Golden Human: 1 = +5000, 2 = +10000, 3 = +15000 per tap
+ if (goldenHumanCount === 1) {
+ petBonus += 5000;
+ } else if (goldenHumanCount === 2) {
+ petBonus += 10000;
+ } else if (goldenHumanCount === 3) {
+ petBonus += 15000;
+ }
// Base tap score is always 1, plus calculated pet bonus
var totalScore = 1 + petBonus;
LK.setScore(LK.getScore() + totalScore);
// Update score display
@@ -523,16 +591,50 @@
goldenPurpleEggPriceText.anchor.set(0.5, 0);
goldenPurpleEggPriceText.x = 2048 / 2 + 300;
goldenPurpleEggPriceText.y = 2150;
shopOverlay.addChild(goldenPurpleEggPriceText);
+ // Add white egg item
+ var whiteEggItem = LK.getAsset('whiteEgg', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ whiteEggItem.x = 2048 / 2 - 300;
+ whiteEggItem.y = 2400;
+ shopOverlay.addChild(whiteEggItem);
+ // Add white egg price text
+ var whiteEggPriceText = new Text2('10M', {
+ size: 60,
+ fill: 0xffffff
+ });
+ whiteEggPriceText.anchor.set(0.5, 0);
+ whiteEggPriceText.x = 2048 / 2 - 300;
+ whiteEggPriceText.y = 2550;
+ shopOverlay.addChild(whiteEggPriceText);
+ // Add golden white egg item
+ var goldenWhiteEggItem = LK.getAsset('goldenWhiteEgg', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ goldenWhiteEggItem.x = 2048 / 2 + 300;
+ goldenWhiteEggItem.y = 2400;
+ shopOverlay.addChild(goldenWhiteEggItem);
+ // Add golden white egg price text
+ var goldenWhiteEggPriceText = new Text2('20M', {
+ size: 60,
+ fill: 0xffd700
+ });
+ goldenWhiteEggPriceText.anchor.set(0.5, 0);
+ goldenWhiteEggPriceText.x = 2048 / 2 + 300;
+ goldenWhiteEggPriceText.y = 2550;
+ shopOverlay.addChild(goldenWhiteEggPriceText);
// Add inventory button
var inventoryBtn = new Text2('Inventory', {
size: 80,
fill: 0xFFFFFF
});
inventoryBtn.anchor.set(0.5, 0);
inventoryBtn.x = 2048 / 2;
- inventoryBtn.y = 2300;
+ inventoryBtn.y = 2650;
shopOverlay.addChild(inventoryBtn);
// Handle egg purchase
eggItem.down = function () {
if (LK.getScore() >= 1000) {
@@ -1478,8 +1580,282 @@
}
};
}
};
+ // Handle white egg purchase
+ whiteEggItem.down = function () {
+ if (LK.getScore() >= 10000000) {
+ LK.setScore(LK.getScore() - 10000000);
+ scoreTxt.setText(LK.getScore().toString());
+ // Close shop
+ shopOverlay.destroy();
+ shopOverlay = null;
+ isShopOpen = false;
+ // Create falling white egg
+ fallingEgg = LK.getAsset('whiteEgg', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ fallingEgg.x = 2048 / 2;
+ fallingEgg.y = -200;
+ eggClickCount = 0;
+ game.addChild(fallingEgg);
+ // Animate egg falling
+ tween(fallingEgg, {
+ y: 2732 / 2
+ }, {
+ duration: 1000
+ });
+ // Handle white egg clicking
+ fallingEgg.down = function () {
+ eggClickCount++;
+ if (eggClickCount === 1) {
+ // First crack
+ var crackedEgg1 = LK.getAsset('crackedEgg1', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ crackedEgg1.x = fallingEgg.x;
+ crackedEgg1.y = fallingEgg.y;
+ game.addChild(crackedEgg1);
+ fallingEgg.destroy();
+ fallingEgg = crackedEgg1;
+ fallingEgg.down = arguments.callee;
+ } else if (eggClickCount === 2) {
+ // Second crack
+ var crackedEgg2 = LK.getAsset('crackedEgg2', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ crackedEgg2.x = fallingEgg.x;
+ crackedEgg2.y = fallingEgg.y;
+ game.addChild(crackedEgg2);
+ fallingEgg.destroy();
+ fallingEgg = crackedEgg2;
+ fallingEgg.down = arguments.callee;
+ } else if (eggClickCount === 3) {
+ // Third crack - almost fully cracked
+ var crackedEgg3 = LK.getAsset('crackedEgg3', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ crackedEgg3.x = fallingEgg.x;
+ crackedEgg3.y = fallingEgg.y;
+ game.addChild(crackedEgg3);
+ fallingEgg.destroy();
+ fallingEgg = crackedEgg3;
+ fallingEgg.down = arguments.callee;
+ } else if (eggClickCount === 4) {
+ // Hatch the white egg with special probabilities
+ var availableWhiteAnimals = [];
+ var whiteAnimalTypes = ['king', 'knight', 'human'];
+ for (var typeIndex = 0; typeIndex < whiteAnimalTypes.length; typeIndex++) {
+ var animalType = whiteAnimalTypes[typeIndex];
+ var countInInventory = 0;
+ for (var invIndex = 0; invIndex < inventory.length; invIndex++) {
+ if (inventory[invIndex] === animalType) {
+ countInInventory++;
+ }
+ }
+ if (countInInventory < 3) {
+ availableWhiteAnimals.push(animalType);
+ }
+ }
+ var animal;
+ if (availableWhiteAnimals.length > 0) {
+ // Special probability distribution for white eggs
+ var random = Math.random();
+ var selectedAnimal;
+ if (random < 0.005) {
+ selectedAnimal = 'king'; // 0.5% chance
+ } else if (random < 0.055) {
+ selectedAnimal = 'knight'; // 5% chance
+ } else {
+ selectedAnimal = 'human'; // 94.5% chance
+ }
+ // Check if selected animal is available
+ if (availableWhiteAnimals.indexOf(selectedAnimal) !== -1) {
+ animal = selectedAnimal;
+ } else {
+ // If selected animal is not available, choose randomly from available
+ var randomIndex = Math.floor(Math.random() * availableWhiteAnimals.length);
+ animal = availableWhiteAnimals[randomIndex];
+ }
+ inventory.push(animal);
+ storage.inventory = inventory;
+ } else {
+ // All white animal types have 3 in inventory
+ animal = null;
+ var allWhitePetsText = new Text2('All white pets maxed out!', {
+ size: 60,
+ fill: 0xff0000
+ });
+ allWhitePetsText.anchor.set(0.5, 0.5);
+ allWhitePetsText.x = 2048 / 2;
+ allWhitePetsText.y = 1500;
+ game.addChild(allWhitePetsText);
+ LK.setTimeout(function () {
+ allWhitePetsText.destroy();
+ }, 2000);
+ }
+ // Only show hatched animal if we got a new pet
+ if (animal) {
+ var animalSprite = LK.getAsset(animal, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ animalSprite.x = fallingEgg.x;
+ animalSprite.y = fallingEgg.y;
+ game.addChild(animalSprite);
+ // Remove animal after showing
+ LK.setTimeout(function () {
+ animalSprite.destroy();
+ }, 2000);
+ }
+ // Remove egg
+ fallingEgg.destroy();
+ fallingEgg = null;
+ }
+ };
+ }
+ };
+ // Handle golden white egg purchase
+ goldenWhiteEggItem.down = function () {
+ if (LK.getScore() >= 20000000) {
+ LK.setScore(LK.getScore() - 20000000);
+ scoreTxt.setText(LK.getScore().toString());
+ // Close shop
+ shopOverlay.destroy();
+ shopOverlay = null;
+ isShopOpen = false;
+ // Create falling golden white egg
+ fallingEgg = LK.getAsset('goldenWhiteEgg', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ fallingEgg.x = 2048 / 2;
+ fallingEgg.y = -200;
+ eggClickCount = 0;
+ game.addChild(fallingEgg);
+ // Animate egg falling
+ tween(fallingEgg, {
+ y: 2732 / 2
+ }, {
+ duration: 1000
+ });
+ // Handle golden white egg clicking
+ fallingEgg.down = function () {
+ eggClickCount++;
+ if (eggClickCount === 1) {
+ // First crack
+ var crackedEgg1 = LK.getAsset('crackedEgg1', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ crackedEgg1.x = fallingEgg.x;
+ crackedEgg1.y = fallingEgg.y;
+ game.addChild(crackedEgg1);
+ fallingEgg.destroy();
+ fallingEgg = crackedEgg1;
+ fallingEgg.down = arguments.callee;
+ } else if (eggClickCount === 2) {
+ // Second crack
+ var crackedEgg2 = LK.getAsset('crackedEgg2', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ crackedEgg2.x = fallingEgg.x;
+ crackedEgg2.y = fallingEgg.y;
+ game.addChild(crackedEgg2);
+ fallingEgg.destroy();
+ fallingEgg = crackedEgg2;
+ fallingEgg.down = arguments.callee;
+ } else if (eggClickCount === 3) {
+ // Third crack - almost fully cracked
+ var crackedEgg3 = LK.getAsset('crackedEgg3', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ crackedEgg3.x = fallingEgg.x;
+ crackedEgg3.y = fallingEgg.y;
+ game.addChild(crackedEgg3);
+ fallingEgg.destroy();
+ fallingEgg = crackedEgg3;
+ fallingEgg.down = arguments.callee;
+ } else if (eggClickCount === 4) {
+ // Hatch the golden white egg with special probabilities
+ var availableGoldenWhiteAnimals = [];
+ var goldenWhiteAnimalTypes = ['goldenKing', 'goldenKnight', 'goldenHuman'];
+ for (var typeIndex = 0; typeIndex < goldenWhiteAnimalTypes.length; typeIndex++) {
+ var animalType = goldenWhiteAnimalTypes[typeIndex];
+ var countInInventory = 0;
+ for (var invIndex = 0; invIndex < inventory.length; invIndex++) {
+ if (inventory[invIndex] === animalType) {
+ countInInventory++;
+ }
+ }
+ if (countInInventory < 3) {
+ availableGoldenWhiteAnimals.push(animalType);
+ }
+ }
+ var animal;
+ if (availableGoldenWhiteAnimals.length > 0) {
+ // Special probability distribution for golden white eggs (same as white)
+ var random = Math.random();
+ var selectedAnimal;
+ if (random < 0.005) {
+ selectedAnimal = 'goldenKing'; // 0.5% chance
+ } else if (random < 0.055) {
+ selectedAnimal = 'goldenKnight'; // 5% chance
+ } else {
+ selectedAnimal = 'goldenHuman'; // 94.5% chance
+ }
+ // Check if selected animal is available
+ if (availableGoldenWhiteAnimals.indexOf(selectedAnimal) !== -1) {
+ animal = selectedAnimal;
+ } else {
+ // If selected animal is not available, choose randomly from available
+ var randomIndex = Math.floor(Math.random() * availableGoldenWhiteAnimals.length);
+ animal = availableGoldenWhiteAnimals[randomIndex];
+ }
+ inventory.push(animal);
+ storage.inventory = inventory;
+ } else {
+ // All golden white animal types have 3 in inventory
+ animal = null;
+ var allGoldenWhitePetsText = new Text2('All golden white pets maxed out!', {
+ size: 60,
+ fill: 0xff0000
+ });
+ allGoldenWhitePetsText.anchor.set(0.5, 0.5);
+ allGoldenWhitePetsText.x = 2048 / 2;
+ allGoldenWhitePetsText.y = 1500;
+ game.addChild(allGoldenWhitePetsText);
+ LK.setTimeout(function () {
+ allGoldenWhitePetsText.destroy();
+ }, 2000);
+ }
+ // Only show hatched animal if we got a new pet
+ if (animal) {
+ var animalSprite = LK.getAsset(animal, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ animalSprite.x = fallingEgg.x;
+ animalSprite.y = fallingEgg.y;
+ game.addChild(animalSprite);
+ // Remove animal after showing
+ LK.setTimeout(function () {
+ animalSprite.destroy();
+ }, 2000);
+ }
+ // Remove egg
+ fallingEgg.destroy();
+ fallingEgg = null;
+ }
+ };
+ }
+ };
// Handle golden egg purchase
goldenEggItem.down = function () {
if (LK.getScore() >= 10000) {
LK.setScore(LK.getScore() - 10000);
@@ -1638,9 +2014,9 @@
game.addChild(inventoryOverlay);
// Display inventory items by unique pet types
var yPos = 300;
var uniqueTypes = [];
- var animalTypes = ['dog', 'cat', 'snake', 'goldenDog', 'goldenCat', 'goldenSnake', 'dinosaur', 'bear', 'bee', 'goldenDinosaur', 'goldenBear', 'goldenBee', 'trex', 'velector', 'titanaBull', 'goldenTrex', 'goldenVelector', 'goldenTitanaBull', 'ironMan', 'captainAmerica', 'spiderman', 'goldenIronMan', 'goldenCaptainAmerica', 'goldenSpiderman'];
+ var animalTypes = ['dog', 'cat', 'snake', 'goldenDog', 'goldenCat', 'goldenSnake', 'dinosaur', 'bear', 'bee', 'goldenDinosaur', 'goldenBear', 'goldenBee', 'trex', 'velector', 'titanaBull', 'goldenTrex', 'goldenVelector', 'goldenTitanaBull', 'ironMan', 'captainAmerica', 'spiderman', 'goldenIronMan', 'goldenCaptainAmerica', 'goldenSpiderman', 'king', 'knight', 'human', 'goldenKing', 'goldenKnight', 'goldenHuman'];
for (var typeIndex = 0; typeIndex < animalTypes.length; typeIndex++) {
var animalType = animalTypes[typeIndex];
var countInInventory = 0;
for (var invIndex = 0; invIndex < inventory.length; invIndex++) {