User prompt
Tm şöyle olcak fruit bu tonla ilgili herşeyi sil ve tree de 2 k güç değil her 1 dk de 1 meyve vercek şansları yine aynı meyveler yere düşücek tree nesnesinin 100 y altına ve üstünde ne kadar zaman kaldığı yazıcak ve yere düşünce karakter ona değerse alabilecek ve event yerinde ekranın en sağ ortasından 100 x solunda bir yeni assets olucak fruits inventory diye ve ona karakter ve karakterin güç nesneleri mesela karakter değişiyo ya 10 m de 100 m de fln onlarda da yap değmeyi değince ekrana bi ui gelcek ın_fruits diye in_inventory dekinin aynısı ve petler gibi x y sıralaracaklar fruit 1 pet in x y sini fruit 2 pet 1 in x-y sini alıcak hepsini bu sırayla ayarla ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
Tıklayınca fruit e yeni bir arayüz açılsın oraya gelsin fruit ler
User prompt
1. Si meyveler assets de yok assetse ekle ikincisi fruite basılıyomu basılmıyomu bilmiyorum tıklayınca hiç bir şey olmuyor basınca dediğin şey olsun pet fln gizlensin ayarla kodu iyice kontrol et
User prompt
Hata düzelt mal yapay zeka click detector çalışmıyo fruit tuşu çalışmıyo ne malsın bak çok kolay click detector ekle şu fruit tuşuna ve 100 y aşşağıya al tuşu
User prompt
Hata düzelt mal yapay zeka click detector çalışmıyo fruit tuşu çalışmıyo ne malsın bak çok kolay click detector ekle şu fruit tuşuna ve 100 y aşşağıya al tuşu
User prompt
/* SIMPLE ENGLISH SPEC (for any AI to understand) Goal: 1) When the user clicks the "tree" object inside the scene, the tree should move into the Inventory and replace the "fruit" item/slot. 2) When the user clicks the "fruit" inside the Inventory, a new "notebook" panel should open. This panel shows fruit places/slots (like pages). It should show fruits instead of the "pet" section. Rules: - Only one tree can replace the fruit slot. - If there is already a tree in the fruit slot, do nothing. - The notebook panel is a simple UI panel with tabs/pages. - When the notebook opens from fruit, hide/disable the "pet" tab and show "fruit" pages. How to do it (very simple plan): - Add a click handler to the tree object: onTreeClick() -> find the "fruit" slot in Inventory -> put the tree item into that slot (replace) -> update the UI - Add a click handler to the Inventory fruit: onInventoryFruitClick() -> openNotebook() -> showFruitPages() -> hidePetSection() -> update the UI Below is example JavaScript that follows this plan. It uses very simple code and can be replaced with your real game/engine code. */ // ----- Fake data models (replace with your real ones) ----- const Inventory = { slots: { // key is slot name fruit: null, // will hold an item object like { id: 'tree', type: 'tree' } pet: null }, set(slotName, item) { this.slots[slotName] = item; renderInventory(); }, get(slotName) { return this.slots[slotName]; } }; const Scene = { objects: { tree: { id: 'tree', type: 'tree', clickable: true } } }; const UIState = { notebookOpen: false, notebookTab: 'none' // 'fruit' or 'pet' }; // ----- Event handlers ----- function onTreeClick() { // 1) Move tree into Inventory, replace fruit const tree = Scene.objects.tree; if (!tree) return; const currentFruitSlot = Inventory.get('fruit'); // If the fruit slot already has a tree, do nothing if (currentFruitSlot && currentFruitSlot.type === 'tree') { return; } // Put the tree into the fruit slot Inventory.set('fruit', { id: 'tree', type: 'tree' }); // Optionally remove tree from scene (if needed) delete Scene.objects.tree; // Update UI log('Tree moved to Inventory (fruit slot).'); } function onInventoryFruitClick() { // 2) Open notebook and show fruit places/pages instead of pet if (!Inventory.get('fruit')) { log('No fruit/tree in Inventory. Nothing to open.'); return; } openNotebook(); showFruitPages(); hidePetSection(); renderNotebook(); log('Notebook opened with fruit pages. Pet section is hidden.'); } // ----- Notebook helpers ----- function openNotebook() { UIState.notebookOpen = true; } function showFruitPages() { UIState.notebookTab = 'fruit'; } function hidePetSection() { // In a real app, you might toggle visibility flags. // Here we just ensure the active tab is not 'pet'. if (UIState.notebookTab === 'pet') { UIState.notebookTab = 'fruit'; } } // ----- Very simple UI render functions (replace with your UI) ----- function renderInventory() { const fruitSlot = Inventory.get('fruit'); const fruitText = fruitSlot ? `[${fruitSlot.type}]` : '[empty]'; const petSlot = Inventory.get('pet'); const petText = petSlot ? `[${petSlot.type}]` : '[empty]'; console.clear(); console.log('=== INVENTORY ==='); console.log('fruit slot :', fruitText); console.log('pet slot :', petText); renderNotebook(true); } function renderNotebook(skipHeader = false) { if (!UIState.notebookOpen) return; if (!skipHeader) console.log('\n=== NOTEBOOK ==='); if (UIState.notebookTab === 'fruit') { console.log('Tab: FRUIT (pet is hidden)'); console.log('- Fruit Page 1: Apple spot'); console.log('- Fruit Page 2: Banana spot'); console.log('- Fruit Page 3: Orange spot'); } else if (UIState.notebookTab === 'pet') { console.log('Tab: PET (but we will not show this when opening from fruit)'); } else { console.log('Notebook open. No tab selected.'); } } function log(msg) { console.log('[INFO]', msg); } // ----- Wire up clicks (example only) ----- // In a real game/engine, replace these with real event bindings. function simulateUserClicks() { // User clicks the tree in the scene onTreeClick(); // User clicks the fruit slot in the Inventory onInventoryFruitClick(); } // Run the demo: renderInventory(); simulateUserClicks(); /* COPY-PASTE SUMMARY (ultra simple): - Click on tree -> move tree to Inventory.fruit slot (replace fruit). - Click on Inventory.fruit -> open notebook -> show fruit pages -> hide pet section. Functions to implement in your project: - onTreeClick() - onInventoryFruitClick() - openNotebook(), showFruitPages(), hidePetSection() - renderInventory(), renderNotebook() */
User prompt
Fruit butonu yeni bir assets olucak 50 y daha altta olucak ve ona tıklayınca tüm pet ler gizlenecek ve page 1/2 yerine page 1/1 olcak neyse tıklarsak yine aynı sayfaya atıcak preve tıklarsakda başka sayfa olmıcak çünkü ve meyveler oraya sıralanacak
User prompt
Hata düzelt inventory kapanınca meyve defteri açan buton gizlenmiyo ve yazısı olması gereken gizlenmesi lazım ve click detectoru çalılmıyo veya kod yeni defter açmıyo açması lazım yani 1 sayfalı pet olmayan meyve gelen sadece öyle bi defter olcak meyveler de perker gibi x y lerini alarak sıralanıcaklar örneğin meyve pet ın x ve y sini alıcak meyve 1 pet 1 ın tarzı
User prompt
Ve şöyle olucak envanter de örneğin pet 1 yoksa pet1_D si gözükecek ama eğer varsa en az 1 ozaman pet1 gösterilecek ve D si gizlenecek tüm petler için geçerli
User prompt
Egg yani ilk yumurta 200 yerine 50 win olsun ve inventory deki next ın altına 75 y altına yeni bi buton ekle ona tıklayınca yeni bir deftere geçer gibi olcak ve oraya pet yerine meyve koyulacak ve assets lere tree diye bir nesne koy event yerinde orta üstte olcak en üst ortanın 100 y altında olcak ve 2k güç isticek ve 2 k gücümüz varsa ve ona tıklarsak meyve koyulan deftere meyve gelicek 5 meyve olucak ilk meyve 80 şansla çıkıyo ikinci meyve 10 şansla üçüncü 5 şansla çıkıyo dördüncü 0.1 şansla çıkıyo ve son meyve 0.001 şansla çıkıyo luck bosstlar meyvelere etki etmiyo
Code edit (1 edits merged)
Please save this source code
User prompt
İn_event arka katmanlarda olcak baya arka yazılar içine gitmicek yani onun o yazıların içine gircek
User prompt
Evente gitmeye tıklarkenki assets inventory assetsi ama olması gereken yeni assets olup isminin event olması lazım ve in_event diye assets oluştur eğer event e tıklarsak in event de gelicek ve yazılar onun üstünde yazıcak katman olarak arkada olcak yani
User prompt
Ve event yerine gittiysek bir daha evente gitmeye tıklarsak geri dönmek istiyormusun yazıcak ingilizce ve evet hayır olcak ingilizce evete tıklarsak geri dönücez ve herşey geri gelicek no da dönmeyecez
User prompt
Click detector leri düzelt çalışmkyo event
User prompt
Şimdi şöyle olcak ilk olarak version: 1.0 yazsın beta yerine ve oyuna yeni bir yer eklicez inventory nin 250 y üstünde bir yer olucak ona tıklayınca evente gitmek istiyor musun yazıcak ama ingilizce ve yes ve no yazıcak no ya tıklarsak kapanacak bu yer yes e tıklarsak ekrandaki kasılma yerleri dusmanlar ve yumurtalar gösterilmeyecek yeni boş bi alana gıdıcez
User prompt
Ve ilk sayfada geri gidince ikinci sayfadaki petler yazılarıyla birlikte gözükmüyo gözükmesi lazım
User prompt
Ve şöyle olsun inventory de sayfa değiştirip 1. Sayfaya gelince rich_water_melon dışında tüm petler yok oluyor yazılarıyla olmadı gereken gözükmesi lazım
User prompt
Please fix the bug: 'Uncaught TypeError: storage.clear is not a function' in or related to this line: 'storage.clear();' Line Number: 1509 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'storage.muscle = undefined;' Line Number: 1509
User prompt
Ayarları sıfırla değilde tüm verileri sıfırla yazsın ve eğer sıfırlar sak oyundaki verilerimiz en baştan başlasın pet lerimiz sıfırlansın boost larımız sıfırlansın muscle sıfırlansın win sıfırlansın aldığımız şeyler shopta sıfırlansın oyundaki herşey oyuna ilk başlayınca nasılsa öyle olsun ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Ayarlar yeni bi assets olucak shop_bg değil settings isimli
User prompt
Shopun 200 x soluna ayarlar tuşu eklicez ona tıklayınca ekranın ortasında 1200 e 1200 lük bi in_settings assetsi açılacak ve orda bi yazı yazıcak ayarları sıfırla diye tıklayınca ayarları sıfırlamak istiyormusun diye sorucak evete tıklarsak game over olucaz hayıra tıklarsak settingten çıkılacak
User prompt
Admin paneli ve yazılarını sil ve uı lerini
User prompt
Hata düzelt admin panel deki sayı click detector leri çalışmıyor 1 e basınca 1 olması 2 ye basınca 2 yazması gibi olması lazım
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Character = Container.expand(function () { var self = Container.call(this); var characterGraphics = self.attachAsset('character', { anchorX: 0.5, anchorY: 0.5 }); // Add floating text for muscle display self.muscleText = new Text2('Muscle: 0', { size: 60, fill: '#ffffff' }); self.muscleText.anchor.set(0.5, 1); self.addChild(self.muscleText); self.speed = 8; self.velocityX = 0; self.velocityY = 0; self.targetRotation = 0; self.setVelocity = function (vx, vy) { self.velocityX = vx; self.velocityY = vy; // Calculate rotation to face movement direction if (vx !== 0 || vy !== 0) { self.targetRotation = Math.atan2(vy, vx); } }; self.update = function () { // Store previous position for collision detection var prevX = self.x; var prevY = self.y; // Move character self.x += self.velocityX * self.speed; self.y += self.velocityY * self.speed; // Check collision with enemy (barrier) var enemyLeft = enemy.x - 100 - 115; // enemy half width + character half width var enemyRight = enemy.x + 100 + 115; var enemyTop = enemy.y - 100 - 115; var enemyBottom = enemy.y + 100 + 115; if (self.x >= enemyLeft && self.x <= enemyRight && self.y >= enemyTop && self.y <= enemyBottom) { // Collision detected, revert to previous position self.x = prevX; self.y = prevY; self.setVelocity(0, 0); } // Check collision with weight lifting area (barrier) var weightLeft = weightLiftingRect.x - 175 - 115; // weight half width + character half width var weightRight = weightLiftingRect.x + 175 + 115; var weightTop = weightLiftingRect.y - 203 - 115; // weight half height + character half width var weightBottom = weightLiftingRect.y + 203 + 115; if (self.x >= weightLeft && self.x <= weightRight && self.y >= weightTop && self.y <= weightBottom) { // Collision detected, revert to previous position self.x = prevX; self.y = prevY; self.setVelocity(0, 0); } // Check collision with second weight lifting area (barrier) var weight1Left = weightLiftingRect1.x - 175 - 115; // weight half width + character half width var weight1Right = weightLiftingRect1.x + 175 + 115; var weight1Top = weightLiftingRect1.y - 203 - 115; // weight half height + character half width var weight1Bottom = weightLiftingRect1.y + 203 + 115; if (self.x >= weight1Left && self.x <= weight1Right && self.y >= weight1Top && self.y <= weight1Bottom) { // Collision detected, revert to previous position self.x = prevX; self.y = prevY; self.setVelocity(0, 0); } // Check collision with third enemy (barrier) var enemy2Left = enemy2.x - 100 - 115; // enemy half width + character half width var enemy2Right = enemy2.x + 100 + 115; var enemy2Top = enemy2.y - 100 - 115; var enemy2Bottom = enemy2.y + 100 + 115; if (self.x >= enemy2Left && self.x <= enemy2Right && self.y >= enemy2Top && self.y <= enemy2Bottom) { // Collision detected, revert to previous position self.x = prevX; self.y = prevY; self.setVelocity(0, 0); } // Check collision with fourth enemy (barrier) var enemy3Left = enemy3.x - 100 - 115; // enemy half width + character half width var enemy3Right = enemy3.x + 100 + 115; var enemy3Top = enemy3.y - 100 - 115; var enemy3Bottom = enemy3.y + 100 + 115; if (self.x >= enemy3Left && self.x <= enemy3Right && self.y >= enemy3Top && self.y <= enemy3Bottom) { // Collision detected, revert to previous position self.x = prevX; self.y = prevY; self.setVelocity(0, 0); } // Check collision with third weight lifting area (barrier) var weight2Left = weightLiftingRect2.x - 175 - 115; // weight half width + character half width var weight2Right = weightLiftingRect2.x + 175 + 115; var weight2Top = weightLiftingRect2.y - 203 - 115; // weight half height + character half width var weight2Bottom = weightLiftingRect2.y + 203 + 115; if (self.x >= weight2Left && self.x <= weight2Right && self.y >= weight2Top && self.y <= weight2Bottom) { // Collision detected, revert to previous position self.x = prevX; self.y = prevY; self.setVelocity(0, 0); } // Keep character within screen bounds only if (self.x < 40) { self.x = 40; } if (self.x > 2008) { self.x = 2008; } if (self.y < 40) { self.y = 40; } if (self.y > 2692) { self.y = 2692; } // Update character graphics based on muscle level var currentAssetId = 'character'; if (muscle >= 100000000) { currentAssetId = 'character_100m'; } else if (muscle >= 10000000) { currentAssetId = 'character_10m'; } else if (muscle >= 1000000) { currentAssetId = 'character_1m'; } else if (muscle >= 100000) { currentAssetId = 'character_100k'; } else if (muscle >= 10000) { currentAssetId = 'character_10k'; } else if (muscle >= 1000) { currentAssetId = 'character_1k'; } // Check if we need to change the character asset if (!self.currentAssetId || self.currentAssetId !== currentAssetId) { // Remove old graphics if (characterGraphics.parent) { self.removeChild(characterGraphics); } // Add new graphics characterGraphics = self.attachAsset(currentAssetId, { anchorX: 0.5, anchorY: 0.5 }); self.currentAssetId = currentAssetId; } // Update muscle text with formatted display self.muscleText.setText('Muscle: ' + formatMuscle(muscle)); self.muscleText.x = 0; self.muscleText.y = -100; // 50px higher than before // Update win text if (!self.winText) { self.winText = new Text2('Win: 0', { size: 60, fill: '#ffffff' }); self.winText.anchor.set(0.5, 1); self.addChild(self.winText); } self.winText.setText('Win: ' + formatWin(win)); self.winText.x = 0; self.winText.y = -150; // 50px above muscle text // Smooth rotation towards target var currentRotation = characterGraphics.rotation; var rotationDiff = self.targetRotation - currentRotation; // Handle rotation wrapping if (rotationDiff > Math.PI) { rotationDiff -= 2 * Math.PI; } if (rotationDiff < -Math.PI) { rotationDiff += 2 * Math.PI; } characterGraphics.rotation += rotationDiff * 0.15; }; return self; }); var Joystick = Container.expand(function () { var self = Container.call(this); var baseGraphics = self.attachAsset('joystickBase', { anchorX: 0.5, anchorY: 0.5 }); var handleGraphics = self.attachAsset('joystickHandle', { anchorX: 0.5, anchorY: 0.5 }); baseGraphics.alpha = 0.3; handleGraphics.alpha = 0.7; self.baseRadius = 100; self.handleRadius = 40; self.isActive = false; self.centerX = 0; self.centerY = 0; self.handleX = 0; self.handleY = 0; self.show = function (x, y) { self.visible = true; self.isActive = true; self.x = x; self.y = y; self.centerX = x; self.centerY = y; self.handleX = 0; self.handleY = 0; handleGraphics.x = 0; handleGraphics.y = 0; }; self.hide = function () { self.visible = false; self.isActive = false; // Smooth return to center tween(handleGraphics, { x: 0, y: 0 }, { duration: 200 }); }; self.updateHandle = function (x, y) { if (!self.isActive) { return; } // Calculate offset from center var offsetX = x - self.centerX; var offsetY = y - self.centerY; var distance = Math.sqrt(offsetX * offsetX + offsetY * offsetY); // Constrain handle within base radius if (distance > self.baseRadius) { offsetX = offsetX / distance * self.baseRadius; offsetY = offsetY / distance * self.baseRadius; distance = self.baseRadius; } self.handleX = offsetX; self.handleY = offsetY; handleGraphics.x = offsetX; handleGraphics.y = offsetY; // Return normalized values for movement return { x: offsetX / self.baseRadius, y: offsetY / self.baseRadius, magnitude: distance / self.baseRadius }; }; self.visible = false; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2C3E50 }); /**** * Game Code ****/ // Initialize muscle variable var muscle = storage.muscle || 0; // Initialize win variable var win = storage.win || 0; // Function to format win numbers with proper decimal places function formatWin(value) { if (value >= 1) { // For values >= 1, use maximum 2 decimal places return Math.round(value * 100) / 100; } else { // For values < 1, round to 2 decimal places and format appropriately var rounded = Math.round(value * 100) / 100; return rounded; } } // Function to format muscle numbers with k, m, b, t notation function formatMuscle(value) { if (value >= 1000000000000) { // For trillions var trillions = value / 1000000000000; if (trillions >= 10) { return Math.floor(trillions) + 't'; } else { return Math.floor(trillions * 10) / 10 + 't'; } } else if (value >= 1000000000) { // For billions var billions = value / 1000000000; if (billions >= 10) { return Math.floor(billions) + 'b'; } else { return Math.floor(billions * 10) / 10 + 'b'; } } else if (value >= 1000000) { // For millions var millions = value / 1000000; if (millions >= 10) { return Math.floor(millions) + 'm'; } else { return Math.floor(millions * 10) / 10 + 'm'; } } else if (value >= 1000) { // For thousands var thousands = value / 1000; if (thousands >= 10) { return Math.floor(thousands) + 'k'; } else { return Math.floor(thousands * 10) / 10 + 'k'; } } else { // For values less than 1000, show with max 2 decimal places return Math.round(value * 100) / 100; } } // Universal function to format all numbers with k, m, b, t notation for display function formatNumber(value) { if (value >= 1000000000000) { // For trillions var trillions = value / 1000000000000; if (trillions >= 10) { return Math.floor(trillions) + 't'; } else { return Math.floor(trillions * 10) / 10 + 't'; } } else if (value >= 1000000000) { // For billions var billions = value / 1000000000; if (billions >= 10) { return Math.floor(billions) + 'b'; } else { return Math.floor(billions * 10) / 10 + 'b'; } } else if (value >= 1000000) { // For millions var millions = value / 1000000; if (millions >= 10) { return Math.floor(millions) + 'm'; } else { return Math.floor(millions * 10) / 10 + 'm'; } } else if (value >= 1000) { // For thousands var thousands = value / 1000; if (thousands >= 10) { return Math.floor(thousands) + 'k'; } else { return Math.floor(thousands * 10) / 10 + 'k'; } } else { // For values < 1000, show with proper decimal places return Math.round(value * 100) / 100; } } // Initialize pet inventory var petCount = storage.petCount || 0; var pet1Count = storage.pet1Count || 0; var pet2Count = storage.pet2Count || 0; var pet3Count = storage.pet3Count || 0; var pet4Count = storage.pet4Count || 0; var pet5Count = storage.pet5Count || 0; var pet6Count = storage.pet6Count || 0; var pet7Count = storage.pet7Count || 0; var pet8Count = storage.pet8Count || 0; var pet9Count = storage.pet9Count || 0; var petSecretCount = storage.petSecretCount || 0; var richWaterMelonCount = storage.richWaterMelonCount || 0; // Initialize pet boost values var petWinBoost = petCount * 0.02; // 0.02 per pet var pet1WinBoost = pet1Count * 0.06; // 0.06 per pet1 var pet2WinBoost = pet2Count * 0.2; // 0.2 per pet2 var pet3WinBoost = pet3Count * 1.5; // 1.5 per pet3 var pet4WinBoost = pet4Count * 60; // 60 per pet4 var pet5WinBoost = pet5Count * 0.1; // 0.1 per pet5 var pet6WinBoost = pet6Count * 0.4; // 0.4 per pet6 var pet7WinBoost = pet7Count * 2; // 2 per pet7 var pet8WinBoost = pet8Count * 15; // 15 per pet8 var pet9WinBoost = pet9Count * 100; // 100 per pet9 var petSecretWinBoost = petSecretCount > 0 ? (petWinBoost + pet1WinBoost + pet2WinBoost + pet3WinBoost + pet4WinBoost + pet5WinBoost + pet6WinBoost + pet7WinBoost + pet8WinBoost + pet9WinBoost) * 5 : 0; var totalWinBoost = petWinBoost + pet1WinBoost + pet2WinBoost + pet3WinBoost + pet4WinBoost + pet5WinBoost + pet6WinBoost + pet7WinBoost + pet8WinBoost + pet9WinBoost + petSecretWinBoost; // Initialize pet muscle boost values var petMuscleBoost = petCount * 0.01; // 0.01 per pet var pet1MuscleBoost = pet1Count * 0.03; // 0.03 per pet1 var pet2MuscleBoost = pet2Count * 0.1; // 0.1 per pet2 var pet3MuscleBoost = pet3Count * 0.75; // 0.75 per pet3 var pet4MuscleBoost = pet4Count * 30; // 30 per pet4 var pet5MuscleBoost = pet5Count * 0.07; // 0.07 per pet5 var pet6MuscleBoost = pet6Count * 0.2; // 0.2 per pet6 var pet7MuscleBoost = pet7Count * 1.2; // 1.2 per pet7 var pet8MuscleBoost = pet8Count * 10; // 10 per pet8 var pet9MuscleBoost = pet9Count * 85; // 85 per pet9 var petSecretMuscleBoost = petSecretCount > 0 ? (petMuscleBoost + pet1MuscleBoost + pet2MuscleBoost + pet3MuscleBoost + pet4MuscleBoost + pet5MuscleBoost + pet6MuscleBoost + pet7MuscleBoost + pet8MuscleBoost + pet9MuscleBoost) * 5 : 0; var totalPetMuscleBoost = petMuscleBoost + pet1MuscleBoost + pet2MuscleBoost + pet3MuscleBoost + pet4MuscleBoost + pet5MuscleBoost + pet6MuscleBoost + pet7MuscleBoost + pet8MuscleBoost + pet9MuscleBoost + petSecretMuscleBoost; // Initialize shop variables var muscleBoost = storage.muscleBoost || 0; // Additional muscle gain per flex var shopPrice = storage.shopPrice || 10; // Current price for muscle boost var shopBoostAmount = 1.5; // Current boost amount var luckBoost = storage.luckBoost || 0; // Luck boost count var luckPrice = storage.luckPrice || 100; // Current price for luck boost var isShopOpen = false; // Track if shop UI is open var isInventoryOpen = false; // Track if inventory UI is open var isAdminOpen = false; // Track if admin panel is open var adminCode = '616172'; // Secret admin code var currentInventoryPage = 1; // Current page in inventory (1 or 2) var maxInventoryPages = 2; // Total pages available // Joystick handle (smaller circle) // Joystick base (semi-transparent circle) // Character shape var character = game.addChild(new Character()); character.x = 1024; character.y = 1366; // Create Weight Lifting rectangle at top-center, 100px from left edge var weightLiftingRect = game.addChild(LK.getAsset('weightLiftingRect', { anchorX: 0.5, anchorY: 0.5 })); weightLiftingRect.x = 200 + 175; // 200px from left + half width (175) to center weightLiftingRect.y = 50 + 110; // 50 + half height (70) to center // Add text above the rectangle var weightLiftingText = new Text2('Weight Lifting', { size: 58, // 36 * 1.6 = 57.6, rounded to 58 fill: '#ffffff' }); weightLiftingText.anchor.set(0.5, 1); weightLiftingText.x = weightLiftingRect.x; weightLiftingText.y = weightLiftingRect.y - 75; game.addChild(weightLiftingText); // Add text below the first weight lifting rectangle showing "0 muscle" var weightLiftingMuscleText = new Text2('0 muscle', { size: 48, fill: '#ffffff' }); weightLiftingMuscleText.anchor.set(0.5, 0); weightLiftingMuscleText.x = weightLiftingRect.x; weightLiftingMuscleText.y = weightLiftingRect.y + 75; game.addChild(weightLiftingMuscleText); // Add "1 muscle" text below the first weight lifting muscle text var weightLiftingMuscleText_1 = new Text2('1 muscle', { size: 48, fill: '#ffffff' }); weightLiftingMuscleText_1.anchor.set(0.5, 0); weightLiftingMuscleText_1.x = weightLiftingRect.x; weightLiftingMuscleText_1.y = weightLiftingMuscleText.y + 40; game.addChild(weightLiftingMuscleText_1); // Create second Weight Lifting rectangle 500px to the right of the first one var weightLiftingRect1 = game.addChild(LK.getAsset('weightLiftingRect1', { anchorX: 0.5, anchorY: 0.5 })); weightLiftingRect1.x = weightLiftingRect.x + 500; // 500px to the right weightLiftingRect1.y = weightLiftingRect.y; // Same Y position // Add text above the second rectangle var weightLiftingText1 = new Text2('Weight Lifting', { size: 58, fill: '#ffffff' }); weightLiftingText1.anchor.set(0.5, 1); weightLiftingText1.x = weightLiftingRect1.x; weightLiftingText1.y = weightLiftingRect1.y - 75; game.addChild(weightLiftingText1); // Add text below the second weight lifting rectangle showing "10k muscle" var weightLiftingMuscleText1 = new Text2('10k muscle', { size: 48, fill: '#ffffff' }); weightLiftingMuscleText1.anchor.set(0.5, 0); weightLiftingMuscleText1.x = weightLiftingRect1.x; weightLiftingMuscleText1.y = weightLiftingRect1.y + 75; game.addChild(weightLiftingMuscleText1); // Add "300 muscle" text below the second weight lifting muscle text var weightLiftingMuscleText1_5 = new Text2('300 muscle', { size: 48, fill: '#ffffff' }); weightLiftingMuscleText1_5.anchor.set(0.5, 0); weightLiftingMuscleText1_5.x = weightLiftingRect1.x; weightLiftingMuscleText1_5.y = weightLiftingMuscleText1.y + 40; game.addChild(weightLiftingMuscleText1_5); // Create third Weight Lifting rectangle to the right of the second one var weightLiftingRect2 = game.addChild(LK.getAsset('weightLiftingRect2', { anchorX: 0.5, anchorY: 0.5 })); weightLiftingRect2.x = weightLiftingRect1.x + 500; // 500px to the right of second one weightLiftingRect2.y = weightLiftingRect1.y; // Same Y position // Add text above the third rectangle var weightLiftingText2 = new Text2('Weight Lifting', { size: 58, fill: '#ffffff' }); weightLiftingText2.anchor.set(0.5, 1); weightLiftingText2.x = weightLiftingRect2.x; weightLiftingText2.y = weightLiftingRect2.y - 75; game.addChild(weightLiftingText2); // Add text below the third weight lifting rectangle showing "100k muscle" var weightLiftingMuscleText2 = new Text2('100k muscle', { size: 48, fill: '#ffffff' }); weightLiftingMuscleText2.anchor.set(0.5, 0); weightLiftingMuscleText2.x = weightLiftingRect2.x; weightLiftingMuscleText2.y = weightLiftingRect2.y + 75; game.addChild(weightLiftingMuscleText2); // Add "2k muscle" text below the third weight lifting muscle text var weightLiftingMuscleText2_2k = new Text2('2k muscle', { size: 48, fill: '#ffffff' }); weightLiftingMuscleText2_2k.anchor.set(0.5, 0); weightLiftingMuscleText2_2k.x = weightLiftingRect2.x; weightLiftingMuscleText2_2k.y = weightLiftingMuscleText2.y + 40; game.addChild(weightLiftingMuscleText2_2k); // Create enemy at top right, 150px from top var enemy = game.addChild(LK.getAsset('dusman', { anchorX: 0.5, anchorY: 0.5 })); enemy.x = 2048 - 200; // Right edge minus half width enemy.y = 150 + 100; // 150px from top plus half height // Add power text above enemy var enemyPowerText = new Text2('Power: ' + formatNumber(10), { size: 60, fill: '#ffffff' }); enemyPowerText.anchor.set(0.5, 1); enemyPowerText.x = enemy.x; enemyPowerText.y = enemy.y - 100; game.addChild(enemyPowerText); // Add "1 win" text below first enemy var enemyWinText = new Text2('1 win', { size: 60, fill: '#ffffff' }); enemyWinText.anchor.set(0.5, 0); enemyWinText.x = enemy.x; enemyWinText.y = enemy.y + 100; game.addChild(enemyWinText); // Create second enemy 300px below the first one var enemy1 = game.addChild(LK.getAsset('dusman1', { anchorX: 0.5, anchorY: 0.5 })); enemy1.x = enemy.x; // Same X position as first enemy enemy1.y = enemy.y + 350; // 350px below first enemy // Add power text above second enemy var enemy1PowerText = new Text2('Power: ' + formatNumber(100), { size: 60, fill: '#ffffff' }); enemy1PowerText.anchor.set(0.5, 1); enemy1PowerText.x = enemy1.x; enemy1PowerText.y = enemy1.y - 100; game.addChild(enemy1PowerText); // Add "15 win" text below second enemy var enemy1WinText = new Text2('15 win', { size: 60, fill: '#ffffff' }); enemy1WinText.anchor.set(0.5, 0); enemy1WinText.x = enemy1.x; enemy1WinText.y = enemy1.y + 100; game.addChild(enemy1WinText); // Create third enemy 350px below the second one var enemy2 = game.addChild(LK.getAsset('dusman2', { anchorX: 0.5, anchorY: 0.5 })); enemy2.x = enemy1.x; // Same X position as previous enemies enemy2.y = enemy1.y + 350; // 350px below second enemy // Add power text above third enemy var enemy2PowerText = new Text2('Power: ' + formatNumber(5000), { size: 60, fill: '#ffffff' }); enemy2PowerText.anchor.set(0.5, 1); enemy2PowerText.x = enemy2.x; enemy2PowerText.y = enemy2.y - 100; game.addChild(enemy2PowerText); // Add "1k win" text below third enemy var enemy2WinText = new Text2('1k win', { size: 60, fill: '#ffffff' }); enemy2WinText.anchor.set(0.5, 0); enemy2WinText.x = enemy2.x; enemy2WinText.y = enemy2.y + 100; game.addChild(enemy2WinText); // Create fourth enemy 350px below the third one var enemy3 = game.addChild(LK.getAsset('dusman3', { anchorX: 0.5, anchorY: 0.5 })); enemy3.x = enemy2.x; // Same X position as previous enemies enemy3.y = enemy2.y + 350; // 350px below third enemy // Add power text above fourth enemy var enemy3PowerText = new Text2('Power: ' + formatNumber(50000), { size: 60, fill: '#ffffff' }); enemy3PowerText.anchor.set(0.5, 1); enemy3PowerText.x = enemy3.x; enemy3PowerText.y = enemy3.y - 100; game.addChild(enemy3PowerText); // Add "10k win" text below fourth enemy var enemy3WinText = new Text2('10k win', { size: 60, fill: '#ffffff' }); enemy3WinText.anchor.set(0.5, 0); enemy3WinText.x = enemy3.x; enemy3WinText.y = enemy3.y + 100; game.addChild(enemy3WinText); // Variables for weight lifting interaction var isMovingToWeights = false; var isWaitingAtWeights = false; var joystick = game.addChild(new Joystick()); var isDragging = false; var joystickTouchId = null; // Create egg object at left center, 200px up from center var egg = game.addChild(LK.getAsset('egg', { anchorX: 0.5, anchorY: 0.5 })); egg.x = 100; // Left edge + some margin egg.y = 866 - 200; // Center Y - 200px // Add "Egg 1" text above egg var eggTitle = new Text2('Egg 1', { size: 60, fill: '#ffffff' }); eggTitle.anchor.set(0.5, 1); eggTitle.x = egg.x; eggTitle.y = egg.y - 160; // Above egg game.addChild(eggTitle); // Add "200 wins" text below egg title var eggCost = new Text2(formatNumber(200) + ' wins', { size: 50, fill: '#ffffff' }); eggCost.anchor.set(0.5, 1); eggCost.x = egg.x; eggCost.y = egg.y - 100; // Below egg title, above egg game.addChild(eggCost); // Create second egg object 400px below the first egg var egg2 = game.addChild(LK.getAsset('egg2', { anchorX: 0.5, anchorY: 0.5 })); egg2.x = egg.x; // Same X position as first egg egg2.y = egg.y + 400; // 400px below first egg (250 + 150) // Add "Egg 2" text above second egg var egg2Title = new Text2('Egg 2', { size: 60, fill: '#ffffff' }); egg2Title.anchor.set(0.5, 1); egg2Title.x = egg2.x; egg2Title.y = egg2.y - 160; // Above egg2 game.addChild(egg2Title); // Add "5k wins" text below egg2 title var egg2Cost = new Text2(formatNumber(5000) + ' wins', { size: 50, fill: '#ffffff' }); egg2Cost.anchor.set(0.5, 1); egg2Cost.x = egg2.x; egg2Cost.y = egg2.y - 100; // Below egg2 title, above egg2 game.addChild(egg2Cost); // Create admin panel button above inventory var adminPanel = LK.gui.bottomRight.addChild(LK.getAsset('admin_panel', { anchorX: 1, anchorY: 1, scaleX: 1, scaleY: 1 })); adminPanel.x = -50; adminPanel.y = -510; // 250px above inventory (260 + 250) // Add admin panel text var adminPanelText = new Text2('Admin Panel', { size: 25, fill: '#ffffff' }); adminPanelText.anchor.set(0.5, 0.5); adminPanelText.x = adminPanel.width / 2; adminPanelText.y = adminPanel.height / 2; adminPanel.addChild(adminPanelText); // Create inventory button above shop var inventory = LK.gui.bottomRight.addChild(LK.getAsset('inventory', { anchorX: 1, anchorY: 1, scaleX: 0.15, scaleY: 0.15 })); inventory.x = -50; inventory.y = -260; // 150px above shop (-50 - 150 = -200) // Add inventory text var inventoryText = new Text2('Inventory', { size: 35, fill: '#ffffff' }); inventoryText.anchor.set(0.5, 0.5); inventoryText.x = inventory.width / 2; inventoryText.y = inventory.height / 2; inventory.addChild(inventoryText); // Create shop object at bottom right var shop = LK.gui.bottomRight.addChild(LK.getAsset('shop_bg', { anchorX: 1, anchorY: 1, scaleX: 0.15, scaleY: 0.15 })); shop.x = -50; shop.y = -50; // Add shop text var shopText = new Text2('Shop', { size: 40, fill: '#ffffff' }); shopText.anchor.set(0.5, 0.5); shopText.x = shop.width / 2; shopText.y = shop.height / 2; shop.addChild(shopText); // Create shop UI (initially hidden) var shopUI = LK.gui.center.addChild(LK.getAsset('shop_bg', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.65, scaleY: 0.65 })); shopUI.visible = false; // Create inventory UI (initially hidden) var inventoryUI = LK.gui.center.addChild(LK.getAsset('inventory', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.65, scaleY: 0.65 })); inventoryUI.visible = false; // Create admin panel UI (initially hidden) var adminPanelUI = LK.gui.center.addChild(LK.getAsset('in_admin_panel', { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 1 })); adminPanelUI.visible = false; // Create admin panel close button var adminCloseButton = LK.gui.center.addChild(LK.getAsset('close', { anchorX: 0.5, anchorY: 0.5 })); adminCloseButton.visible = false; adminCloseButton.x = 350; adminCloseButton.y = -250; // Create admin panel input prompt var adminCodePrompt = LK.gui.center.addChild(new Text2('Enter Code:', { size: 60, fill: '#ffffff' })); adminCodePrompt.anchor.set(0.5, 0.5); adminCodePrompt.visible = false; adminCodePrompt.x = 0; adminCodePrompt.y = -300; // Create number input buttons (0-9) in phone keypad layout var numberButtons = []; var numberButtonTexts = []; for (var i = 0; i <= 9; i++) { var buttonX, buttonY; if (i === 0) { // 0 button at bottom center buttonX = 0; buttonY = 200; } else if (i >= 1 && i <= 3) { // 1, 2, 3 at top row buttonX = (i - 2) * 100; buttonY = -50; } else if (i >= 4 && i <= 6) { // 4, 5, 6 at middle row buttonX = (i - 5) * 100; buttonY = 50; } else if (i >= 7 && i <= 9) { // 7, 8, 9 at bottom row buttonX = (i - 8) * 100; buttonY = 150; } var button = LK.gui.center.addChild(LK.getAsset('admin_number_btn', { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 1 })); button.x = buttonX; button.y = buttonY; button.visible = false; var buttonText = new Text2(i.toString(), { size: 80, fill: '#ffffff' }); buttonText.anchor.set(0.5, 0.5); button.addChild(buttonText); numberButtons.push(button); numberButtonTexts.push(buttonText); } // Create admin panel controls text var adminMuscleText = LK.gui.center.addChild(new Text2('Muscle', { size: 60, fill: '#ffffff' })); adminMuscleText.anchor.set(0.5, 0.5); adminMuscleText.visible = false; adminMuscleText.x = 0; adminMuscleText.y = -150; var adminWinText = LK.gui.center.addChild(new Text2('Win', { size: 60, fill: '#ffffff' })); adminWinText.anchor.set(0.5, 0.5); adminWinText.visible = false; adminWinText.x = 0; adminWinText.y = -50; var adminLuckText = LK.gui.center.addChild(new Text2('Luck Boost', { size: 60, fill: '#ffffff' })); adminLuckText.anchor.set(0.5, 0.5); adminLuckText.visible = false; adminLuckText.x = 0; adminLuckText.y = 50; var adminEnterButton = LK.gui.center.addChild(LK.getAsset('admin_number_btn', { anchorX: 0.5, anchorY: 0.5 })); adminEnterButton.visible = false; adminEnterButton.x = 0; adminEnterButton.y = 150; var adminEnterText = new Text2('Enter', { size: 40, fill: '#ffffff' }); adminEnterText.anchor.set(0.5, 0.5); adminEnterButton.addChild(adminEnterText); var adminDeleteButton = LK.gui.center.addChild(LK.getAsset('admin_number_btn', { anchorX: 0.5, anchorY: 0.5 })); adminDeleteButton.visible = false; adminDeleteButton.x = 100; adminDeleteButton.y = 150; var adminDeleteText = new Text2('Delete', { size: 35, fill: '#ff0000' }); adminDeleteText.anchor.set(0.5, 0.5); adminDeleteButton.addChild(adminDeleteText); // Variables for admin input var currentInputCode = ''; var isCodePromptActive = false; var isAdminInputMode = false; var adminInputType = ''; var adminCurrentValue = ''; // Create in_inventory image UI element (initially hidden) var inInventoryImage = LK.gui.center.addChild(LK.getAsset('in_inventory', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 })); inInventoryImage.visible = false; // Create pet display elements (initially hidden) var petDisplay = LK.gui.center.addChild(LK.getAsset('pet', { anchorX: 0.5, anchorY: 0.5 })); petDisplay.visible = false; petDisplay.x = -280; petDisplay.y = -140; var pet1Display = LK.gui.center.addChild(LK.getAsset('pet1', { anchorX: 0.5, anchorY: 0.5 })); pet1Display.visible = false; pet1Display.x = -40; pet1Display.y = -140; var pet2Display = LK.gui.center.addChild(LK.getAsset('pet2', { anchorX: 0.5, anchorY: 0.5 })); pet2Display.visible = false; pet2Display.x = 200; pet2Display.y = -140; var pet3Display = LK.gui.center.addChild(LK.getAsset('pet3', { anchorX: 0.5, anchorY: 0.5 })); pet3Display.visible = false; pet3Display.x = -280; pet3Display.y = 160; var pet4Display = LK.gui.center.addChild(LK.getAsset('pet4', { anchorX: 0.5, anchorY: 0.5 })); pet4Display.visible = false; pet4Display.x = -40; pet4Display.y = 160; // Create count text for pets var petCountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); petCountText.anchor.set(0, 1); petCountText.visible = false; petCountText.x = -265 - 50; // Bottom left of pet display petCountText.y = -105; var pet1CountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); pet1CountText.anchor.set(0, 1); pet1CountText.visible = false; pet1CountText.x = -25 - 50; // Bottom left of pet1 display pet1CountText.y = -105; var pet2CountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); pet2CountText.anchor.set(0, 1); pet2CountText.visible = false; pet2CountText.x = 215 - 50; // Bottom left of pet2 display pet2CountText.y = -105; var pet3CountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); pet3CountText.anchor.set(0, 1); pet3CountText.visible = false; pet3CountText.x = -265 - 50; // Bottom left of pet3 display pet3CountText.y = 195; var pet4CountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); pet4CountText.anchor.set(0, 1); pet4CountText.visible = false; pet4CountText.x = -25 - 50; // Bottom left of pet4 display pet4CountText.y = 195; // Add pet chance and boost text var petChanceText = LK.gui.center.addChild(new Text2('70%', { size: 35, fill: '#ffffff' })); petChanceText.anchor.set(0.5, 0); petChanceText.visible = false; petChanceText.x = -280; petChanceText.y = -70; // Below pet display var petBoostText = LK.gui.center.addChild(new Text2('Win boost = 0.02', { size: 27, fill: '#ffffff' })); petBoostText.anchor.set(0.5, 0); petBoostText.visible = false; petBoostText.x = -280; petBoostText.y = -35; // Below chance text // Add pet1 chance and boost text var pet1ChanceText = LK.gui.center.addChild(new Text2('30%', { size: 35, fill: '#ffffff' })); pet1ChanceText.anchor.set(0.5, 0); pet1ChanceText.visible = false; pet1ChanceText.x = -40; pet1ChanceText.y = -70; // Below pet1 display var pet1BoostText = LK.gui.center.addChild(new Text2('Win boost = 0.06', { size: 27, fill: '#ffffff' })); pet1BoostText.anchor.set(0.5, 0); pet1BoostText.visible = false; pet1BoostText.x = -40; pet1BoostText.y = -35; // Below chance text // Add pet muscle boost text var petMuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.01', { size: 23, fill: '#ffffff' })); petMuscleBoostText.anchor.set(0.5, 0); petMuscleBoostText.visible = false; petMuscleBoostText.x = -280; petMuscleBoostText.y = 0; // Below win boost text // Add pet1 muscle boost text var pet1MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.03', { size: 23, fill: '#ffffff' })); pet1MuscleBoostText.anchor.set(0.5, 0); pet1MuscleBoostText.visible = false; pet1MuscleBoostText.x = -40; pet1MuscleBoostText.y = 0; // Below win boost text // Add pet2 chance and boost text var pet2ChanceText = LK.gui.center.addChild(new Text2('10%', { size: 35, fill: '#ffffff' })); pet2ChanceText.anchor.set(0.5, 0); pet2ChanceText.visible = false; pet2ChanceText.x = 200; pet2ChanceText.y = -70; // Below pet2 display var pet2BoostText = LK.gui.center.addChild(new Text2('Win boost = 0.2', { size: 27, fill: '#ffffff' })); pet2BoostText.anchor.set(0.5, 0); pet2BoostText.visible = false; pet2BoostText.x = 200; pet2BoostText.y = -35; // Below chance text var pet2MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.1', { size: 23, fill: '#ffffff' })); pet2MuscleBoostText.anchor.set(0.5, 0); pet2MuscleBoostText.visible = false; pet2MuscleBoostText.x = 200; pet2MuscleBoostText.y = 0; // Below win boost text // Add pet3 chance and boost text var pet3ChanceText = LK.gui.center.addChild(new Text2('1%', { size: 35, fill: '#ffffff' })); pet3ChanceText.anchor.set(0.5, 0); pet3ChanceText.visible = false; pet3ChanceText.x = -280; pet3ChanceText.y = 230; // Below pet3 display var pet3BoostText = LK.gui.center.addChild(new Text2('Win boost = 1.5', { size: 27, fill: '#ffffff' })); pet3BoostText.anchor.set(0.5, 0); pet3BoostText.visible = false; pet3BoostText.x = -280; pet3BoostText.y = 265; // Below chance text var pet3MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.75', { size: 23, fill: '#ffffff' })); pet3MuscleBoostText.anchor.set(0.5, 0); pet3MuscleBoostText.visible = false; pet3MuscleBoostText.x = -280; pet3MuscleBoostText.y = 300; // Below win boost text // Add pet4 chance and boost text var pet4ChanceText = LK.gui.center.addChild(new Text2('0.0001%', { size: 35, fill: '#ffffff' })); pet4ChanceText.anchor.set(0.5, 0); pet4ChanceText.visible = false; pet4ChanceText.x = -40; pet4ChanceText.y = 230; // Below pet4 display var pet4BoostText = LK.gui.center.addChild(new Text2('Win boost = 60', { size: 27, fill: '#ffffff' })); pet4BoostText.anchor.set(0.5, 0); pet4BoostText.visible = false; pet4BoostText.x = -40; pet4BoostText.y = 265; // Below chance text var pet4MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 30', { size: 23, fill: '#ffffff' })); pet4MuscleBoostText.anchor.set(0.5, 0); pet4MuscleBoostText.visible = false; pet4MuscleBoostText.x = -40; pet4MuscleBoostText.y = 300; // Below win boost text // Create pet5 display (page 2, top left - highest chance) var pet5Display = LK.gui.center.addChild(LK.getAsset('pet5', { anchorX: 0.5, anchorY: 0.5 })); pet5Display.visible = false; pet5Display.x = -280; pet5Display.y = -140; var pet5CountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); pet5CountText.anchor.set(0, 1); pet5CountText.visible = false; pet5CountText.x = -265 - 50; pet5CountText.y = -105; var pet5ChanceText = LK.gui.center.addChild(new Text2('50%', { size: 35, fill: '#ffffff' })); pet5ChanceText.anchor.set(0.5, 0); pet5ChanceText.visible = false; pet5ChanceText.x = -280; pet5ChanceText.y = -70; var pet5BoostText = LK.gui.center.addChild(new Text2('Win boost = 0.1', { size: 27, fill: '#ffffff' })); pet5BoostText.anchor.set(0.5, 0); pet5BoostText.visible = false; pet5BoostText.x = -280; pet5BoostText.y = -35; var pet5MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.07', { size: 23, fill: '#ffffff' })); pet5MuscleBoostText.anchor.set(0.5, 0); pet5MuscleBoostText.visible = false; pet5MuscleBoostText.x = -280; pet5MuscleBoostText.y = 0; // Create pet6 display (page 2, top center - second highest chance) var pet6Display = LK.gui.center.addChild(LK.getAsset('pet6', { anchorX: 0.5, anchorY: 0.5 })); pet6Display.visible = false; pet6Display.x = -40; pet6Display.y = -140; var pet6CountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); pet6CountText.anchor.set(0, 1); pet6CountText.visible = false; pet6CountText.x = -25 - 50; pet6CountText.y = -105; var pet6ChanceText = LK.gui.center.addChild(new Text2('20%', { size: 35, fill: '#ffffff' })); pet6ChanceText.anchor.set(0.5, 0); pet6ChanceText.visible = false; pet6ChanceText.x = -40; pet6ChanceText.y = -70; var pet6BoostText = LK.gui.center.addChild(new Text2('Win boost = 0.4', { size: 27, fill: '#ffffff' })); pet6BoostText.anchor.set(0.5, 0); pet6BoostText.visible = false; pet6BoostText.x = -40; pet6BoostText.y = -35; var pet6MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.2', { size: 23, fill: '#ffffff' })); pet6MuscleBoostText.anchor.set(0.5, 0); pet6MuscleBoostText.visible = false; pet6MuscleBoostText.x = -40; pet6MuscleBoostText.y = 0; // Create pet7 display (page 2, top right - medium chance) var pet7Display = LK.gui.center.addChild(LK.getAsset('pet7', { anchorX: 0.5, anchorY: 0.5 })); pet7Display.visible = false; pet7Display.x = 200; pet7Display.y = -140; var pet7CountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); pet7CountText.anchor.set(0, 1); pet7CountText.visible = false; pet7CountText.x = 215 - 50; pet7CountText.y = -105; var pet7ChanceText = LK.gui.center.addChild(new Text2('5%', { size: 35, fill: '#ffffff' })); pet7ChanceText.anchor.set(0.5, 0); pet7ChanceText.visible = false; pet7ChanceText.x = 200; pet7ChanceText.y = -70; var pet7BoostText = LK.gui.center.addChild(new Text2('Win boost = 2', { size: 27, fill: '#ffffff' })); pet7BoostText.anchor.set(0.5, 0); pet7BoostText.visible = false; pet7BoostText.x = 200; pet7BoostText.y = -35; var pet7MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 1.2', { size: 23, fill: '#ffffff' })); pet7MuscleBoostText.anchor.set(0.5, 0); pet7MuscleBoostText.visible = false; pet7MuscleBoostText.x = 200; pet7MuscleBoostText.y = 0; // Create pet8 display (page 2, bottom left - low chance) var pet8Display = LK.gui.center.addChild(LK.getAsset('pet8', { anchorX: 0.5, anchorY: 0.5 })); pet8Display.visible = false; pet8Display.x = -280; pet8Display.y = 160; var pet8CountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); pet8CountText.anchor.set(0, 1); pet8CountText.visible = false; pet8CountText.x = -265 - 50; pet8CountText.y = 195; var pet8ChanceText = LK.gui.center.addChild(new Text2('1%', { size: 35, fill: '#ffffff' })); pet8ChanceText.anchor.set(0.5, 0); pet8ChanceText.visible = false; pet8ChanceText.x = -280; pet8ChanceText.y = 230; var pet8BoostText = LK.gui.center.addChild(new Text2('Win boost = 15', { size: 27, fill: '#ffffff' })); pet8BoostText.anchor.set(0.5, 0); pet8BoostText.visible = false; pet8BoostText.x = -280; pet8BoostText.y = 265; var pet8MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 10', { size: 23, fill: '#ffffff' })); pet8MuscleBoostText.anchor.set(0.5, 0); pet8MuscleBoostText.visible = false; pet8MuscleBoostText.x = -280; pet8MuscleBoostText.y = 300; // Create pet9 display (page 2, bottom center - very low chance) var pet9Display = LK.gui.center.addChild(LK.getAsset('pet9', { anchorX: 0.5, anchorY: 0.5 })); pet9Display.visible = false; pet9Display.x = -40; pet9Display.y = 160; var pet9CountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); pet9CountText.anchor.set(0, 1); pet9CountText.visible = false; pet9CountText.x = -25 - 50; pet9CountText.y = 195; var pet9ChanceText = LK.gui.center.addChild(new Text2('0.06%', { size: 35, fill: '#ffffff' })); pet9ChanceText.anchor.set(0.5, 0); pet9ChanceText.visible = false; pet9ChanceText.x = -40; pet9ChanceText.y = 230; var pet9BoostText = LK.gui.center.addChild(new Text2('Win boost = 100', { size: 27, fill: '#ffffff' })); pet9BoostText.anchor.set(0.5, 0); pet9BoostText.visible = false; pet9BoostText.x = -40; pet9BoostText.y = 265; var pet9MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 85', { size: 23, fill: '#ffffff' })); pet9MuscleBoostText.anchor.set(0.5, 0); pet9MuscleBoostText.visible = false; pet9MuscleBoostText.x = -40; pet9MuscleBoostText.y = 300; // Create secret pet display (page 2, below pet7 - ultra rare) var petSecretDisplay = LK.gui.center.addChild(LK.getAsset('petSecret', { anchorX: 0.5, anchorY: 0.5 })); petSecretDisplay.visible = false; petSecretDisplay.x = 200; // Same X as pet7 petSecretDisplay.y = 160; // Same Y as pet9 var petSecretCountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); petSecretCountText.anchor.set(0, 1); petSecretCountText.visible = false; petSecretCountText.x = 215 - 50; petSecretCountText.y = 195; var petSecretChanceText = LK.gui.center.addChild(new Text2('0.00001%', { size: 35, fill: '#ffffff' })); petSecretChanceText.anchor.set(0.5, 0); petSecretChanceText.visible = false; petSecretChanceText.x = 200; petSecretChanceText.y = 230; var petSecretBoostText = LK.gui.center.addChild(new Text2('All muscle boost 5x', { size: 23, fill: '#ffffff' })); petSecretBoostText.anchor.set(0.5, 0); petSecretBoostText.visible = false; petSecretBoostText.x = 200; petSecretBoostText.y = 265; var petSecretWinBoostText = LK.gui.center.addChild(new Text2('All win boost 5x', { size: 23, fill: '#ffffff' })); petSecretWinBoostText.anchor.set(0.5, 0); petSecretWinBoostText.visible = false; petSecretWinBoostText.x = 200; petSecretWinBoostText.y = 300; // Create rich_water_melon display (page 1, bottom left) var richWaterMelonDisplay = LK.gui.center.addChild(LK.getAsset('rich_water_melon', { anchorX: 0.5, anchorY: 0.5 })); richWaterMelonDisplay.visible = false; richWaterMelonDisplay.x = 200; richWaterMelonDisplay.y = 160; var richWaterMelonCountText = LK.gui.center.addChild(new Text2('0x', { size: 55, fill: '#ffffff' })); richWaterMelonCountText.anchor.set(0, 1); richWaterMelonCountText.visible = false; richWaterMelonCountText.x = 215 - 50; richWaterMelonCountText.y = 195; var richWaterMelonChanceText = LK.gui.center.addChild(new Text2('0.000075%', { size: 35, fill: '#ffffff' })); richWaterMelonChanceText.anchor.set(0.5, 0); richWaterMelonChanceText.visible = false; richWaterMelonChanceText.x = 200; richWaterMelonChanceText.y = 230; var richWaterMelonBoostText = LK.gui.center.addChild(new Text2('All secret pets 5x', { size: 23, fill: '#ffffff' })); richWaterMelonBoostText.anchor.set(0.5, 0); richWaterMelonBoostText.visible = false; richWaterMelonBoostText.x = 200; richWaterMelonBoostText.y = 265; // Create achievements_1b_win display (page 1, same position as rich_water_melon) var achievementsDisplay = LK.gui.center.addChild(LK.getAsset('achievements_1b_win', { anchorX: 0.5, anchorY: 0.5 })); achievementsDisplay.visible = false; achievementsDisplay.x = 200; achievementsDisplay.y = 160; var achievementsCountText = LK.gui.center.addChild(new Text2('Always visible', { size: 35, fill: '#ffffff' })); achievementsCountText.anchor.set(0.5, 0); achievementsCountText.visible = false; achievementsCountText.x = 200; achievementsCountText.y = 230; var achievementsInfoText = LK.gui.center.addChild(new Text2('Hidden pet placeholder', { size: 23, fill: '#ffffff' })); achievementsInfoText.anchor.set(0.5, 0); achievementsInfoText.visible = false; achievementsInfoText.x = 200; achievementsInfoText.y = 265; // Create close1 button for inventory (initially hidden) var close1Button = LK.gui.center.addChild(LK.getAsset('close', { anchorX: 0.5, anchorY: 0.5 })); close1Button.visible = false; close1Button.x = 538; close1Button.y = -315; // Create next page button for inventory (initially hidden) var nextPageButton = LK.gui.center.addChild(LK.getAsset('nextPage', { anchorX: 0.5, anchorY: 0.5 })); nextPageButton.visible = false; nextPageButton.x = close1Button.x; nextPageButton.y = close1Button.y + 150; // Add text to next page button var nextPageText = new Text2('Next', { size: 35, fill: '#ffffff' }); nextPageText.anchor.set(0.5, 0.5); nextPageButton.addChild(nextPageText); // Create previous page button for inventory (initially hidden) var prevPageButton = LK.gui.center.addChild(LK.getAsset('prevPage', { anchorX: 0.5, anchorY: 0.5 })); prevPageButton.visible = false; prevPageButton.x = -close1Button.x; // Left side, opposite of close button prevPageButton.y = close1Button.y + 150; // Same Y as next button // Add text to previous page button var prevPageText = new Text2('Prev', { size: 35, fill: '#ffffff' }); prevPageText.anchor.set(0.5, 0.5); prevPageButton.addChild(prevPageText); // Create page number display for inventory (initially hidden) var pageNumberDisplay = LK.gui.center.addChild(new Text2('Page 1/2', { size: 40, fill: '#ffffff' })); pageNumberDisplay.anchor.set(0.5, 0); pageNumberDisplay.visible = false; pageNumberDisplay.x = 0; pageNumberDisplay.y = -265; // Create shopping image UI element (initially hidden) var shoppingImage = LK.gui.center.addChild(LK.getAsset('shopping', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 })); shoppingImage.visible = false; // Create close button UI element (initially hidden) var closeButton = LK.gui.center.addChild(LK.getAsset('close', { anchorX: 0.5, anchorY: 0.5 })); closeButton.visible = false; closeButton.x = 310; // Position close button to the right of shopping image closeButton.y = -310; // Position close button at the top of shopping image // Add shop upgrade text var shopUpgradeText = LK.gui.center.addChild(new Text2(formatNumber(shopPrice) + ' muscle = + ' + formatNumber(1) + ' muscle boost', { size: 45, fill: '#ffffff', font: 'bold serif' })); shopUpgradeText.anchor.set(0.5, 0.5); shopUpgradeText.x = 0; shopUpgradeText.y = -200; shopUpgradeText.visible = false; // Add luck boost upgrade text var luckUpgradeText = LK.gui.center.addChild(new Text2(formatNumber(luckPrice) + ' win = + 1 luck boost', { size: 45, fill: '#ffffff', font: 'bold serif' })); luckUpgradeText.anchor.set(0.5, 0.5); luckUpgradeText.x = 0; luckUpgradeText.y = -100; luckUpgradeText.visible = false; // Add win boost display in bottom left var winBoostDisplay = LK.gui.bottomLeft.addChild(new Text2('Win Boost: ' + formatNumber(totalWinBoost), { size: 50, fill: '#ffffff' })); winBoostDisplay.anchor.set(0, 1); winBoostDisplay.x = 20; winBoostDisplay.y = -20; // Add muscle boost display in bottom left var muscleBoostDisplay = LK.gui.bottomLeft.addChild(new Text2('Muscle Boost: ' + formatNumber(muscleBoost + totalPetMuscleBoost), { size: 50, fill: '#ffffff', font: 'bold serif' })); muscleBoostDisplay.anchor.set(0, 1); muscleBoostDisplay.x = 20; muscleBoostDisplay.y = -80; // Add version display above luck boost var versionDisplay = LK.gui.bottomLeft.addChild(new Text2('version: beta', { size: 80, fill: '#ffffff' })); versionDisplay.anchor.set(0, 1); versionDisplay.x = 20; versionDisplay.y = -230; // Add luck boost display in bottom left var luckBoostDisplay = LK.gui.bottomLeft.addChild(new Text2('Luck Boost: ' + formatNumber(luckBoost), { size: 50, fill: '#ffffff' })); luckBoostDisplay.anchor.set(0, 1); luckBoostDisplay.x = 20; luckBoostDisplay.y = -140; // Add close button text var closeShopText = new Text2('Close', { size: 50, fill: '#ff0000' }); closeShopText.anchor.set(0.5, 0.5); closeShopText.x = 0; closeShopText.y = 200; shopUI.addChild(closeShopText); game.down = function (x, y, obj) { // Check if inventory UI is open if (isInventoryOpen) { // Check if close1 button was clicked (convert screen coordinates to GUI coordinates) var screenY = y * (LK.gui.height / 2732); var screenX = x * (LK.gui.width / 2048); var guiCenterX = LK.gui.width / 2; var guiCenterY = LK.gui.height / 2; // Calculate close1 button bounds in screen coordinates var close1Bounds = { left: guiCenterX + close1Button.x - 50, right: guiCenterX + close1Button.x + 50, top: guiCenterY + close1Button.y - 50, bottom: guiCenterY + close1Button.y + 50 }; if (screenX >= close1Bounds.left && screenX <= close1Bounds.right && screenY >= close1Bounds.top && screenY <= close1Bounds.bottom) { // Close inventory isInventoryOpen = false; inInventoryImage.visible = false; close1Button.visible = false; nextPageButton.visible = false; prevPageButton.visible = false; pageNumberDisplay.visible = false; // Hide pet displays petDisplay.visible = false; pet1Display.visible = false; pet2Display.visible = false; pet3Display.visible = false; pet4Display.visible = false; petCountText.visible = false; pet1CountText.visible = false; pet2CountText.visible = false; pet3CountText.visible = false; pet4CountText.visible = false; petChanceText.visible = false; petBoostText.visible = false; pet1ChanceText.visible = false; pet1BoostText.visible = false; pet2ChanceText.visible = false; pet2BoostText.visible = false; pet3ChanceText.visible = false; pet3BoostText.visible = false; pet4ChanceText.visible = false; pet4BoostText.visible = false; petMuscleBoostText.visible = false; pet1MuscleBoostText.visible = false; pet2MuscleBoostText.visible = false; pet3MuscleBoostText.visible = false; pet4MuscleBoostText.visible = false; // Hide page 2 pet displays pet5Display.visible = false; pet6Display.visible = false; pet7Display.visible = false; pet8Display.visible = false; pet9Display.visible = false; petSecretDisplay.visible = false; pet5CountText.visible = false; pet6CountText.visible = false; pet7CountText.visible = false; pet8CountText.visible = false; pet9CountText.visible = false; petSecretCountText.visible = false; pet5ChanceText.visible = false; pet6ChanceText.visible = false; pet7ChanceText.visible = false; pet8ChanceText.visible = false; pet9ChanceText.visible = false; petSecretChanceText.visible = false; pet5BoostText.visible = false; pet6BoostText.visible = false; pet7BoostText.visible = false; pet8BoostText.visible = false; pet9BoostText.visible = false; petSecretBoostText.visible = false; pet5MuscleBoostText.visible = false; pet6MuscleBoostText.visible = false; pet7MuscleBoostText.visible = false; pet8MuscleBoostText.visible = false; pet9MuscleBoostText.visible = false; petSecretWinBoostText.visible = false; richWaterMelonDisplay.visible = false; richWaterMelonCountText.visible = false; richWaterMelonChanceText.visible = false; richWaterMelonBoostText.visible = false; achievementsDisplay.visible = false; achievementsCountText.visible = false; achievementsInfoText.visible = false; return; } // Calculate next page button bounds in screen coordinates var nextPageBounds = { left: guiCenterX + nextPageButton.x - 60, right: guiCenterX + nextPageButton.x + 60, top: guiCenterY + nextPageButton.y - 40, bottom: guiCenterY + nextPageButton.y + 40 }; if (screenX >= nextPageBounds.left && screenX <= nextPageBounds.right && screenY >= nextPageBounds.top && screenY <= nextPageBounds.bottom) { // Switch to next page currentInventoryPage = currentInventoryPage + 1; if (currentInventoryPage > maxInventoryPages) { currentInventoryPage = 1; // Loop back to first page } // Update page display pageNumberDisplay.setText('Page ' + currentInventoryPage + '/' + maxInventoryPages); // Hide all pet displays first petDisplay.visible = false; pet1Display.visible = false; pet2Display.visible = false; pet3Display.visible = false; pet4Display.visible = false; petCountText.visible = false; pet1CountText.visible = false; pet2CountText.visible = false; pet3CountText.visible = false; pet4CountText.visible = false; petChanceText.visible = false; petBoostText.visible = false; pet1ChanceText.visible = false; pet1BoostText.visible = false; pet2ChanceText.visible = false; pet2BoostText.visible = false; pet3ChanceText.visible = false; pet3BoostText.visible = false; pet4ChanceText.visible = false; pet4BoostText.visible = false; petMuscleBoostText.visible = false; pet1MuscleBoostText.visible = false; pet2MuscleBoostText.visible = false; pet3MuscleBoostText.visible = false; pet4MuscleBoostText.visible = false; // Hide new pet displays pet5Display.visible = false; pet6Display.visible = false; pet7Display.visible = false; pet8Display.visible = false; pet9Display.visible = false; petSecretDisplay.visible = false; pet5CountText.visible = false; pet6CountText.visible = false; pet7CountText.visible = false; pet8CountText.visible = false; pet9CountText.visible = false; petSecretCountText.visible = false; pet5ChanceText.visible = false; pet6ChanceText.visible = false; pet7ChanceText.visible = false; pet8ChanceText.visible = false; pet9ChanceText.visible = false; petSecretChanceText.visible = false; pet5BoostText.visible = false; pet6BoostText.visible = false; pet7BoostText.visible = false; pet8BoostText.visible = false; pet9BoostText.visible = false; petSecretBoostText.visible = false; pet5MuscleBoostText.visible = false; pet6MuscleBoostText.visible = false; pet7MuscleBoostText.visible = false; pet8MuscleBoostText.visible = false; pet9MuscleBoostText.visible = false; petSecretWinBoostText.visible = false; richWaterMelonDisplay.visible = false; richWaterMelonCountText.visible = false; richWaterMelonChanceText.visible = false; richWaterMelonBoostText.visible = false; achievementsDisplay.visible = false; achievementsCountText.visible = false; achievementsInfoText.visible = false; // Show pets based on current page pet5Display.visible = false; pet6Display.visible = false; pet7Display.visible = false; pet8Display.visible = false; pet9Display.visible = false; petSecretDisplay.visible = false; pet5CountText.visible = false; pet6CountText.visible = false; pet7CountText.visible = false; pet8CountText.visible = false; pet9CountText.visible = false; petSecretCountText.visible = false; pet5ChanceText.visible = false; pet6ChanceText.visible = false; pet7ChanceText.visible = false; pet8ChanceText.visible = false; pet9ChanceText.visible = false; petSecretChanceText.visible = false; pet5BoostText.visible = false; pet6BoostText.visible = false; pet7BoostText.visible = false; pet8BoostText.visible = false; pet9BoostText.visible = false; petSecretBoostText.visible = false; pet5MuscleBoostText.visible = false; pet6MuscleBoostText.visible = false; pet7MuscleBoostText.visible = false; pet8MuscleBoostText.visible = false; pet9MuscleBoostText.visible = false; petSecretWinBoostText.visible = false; // Show pets based on current page if (currentInventoryPage === 1) { // Page 1: Show all pets (pet, pet1, pet2, pet3, pet4) // Calculate dynamic chances with luck boost var luckMultiplier = 1 + luckBoost * 0.25; var basePetChance = Math.max(0, 70 * Math.pow(0.95, luckBoost)); var basePet1Chance = Math.max(0, 30 * Math.pow(0.96, luckBoost)); var basePet2Chance = Math.max(0, 10 * Math.pow(0.97, luckBoost)); var basePet3Chance = 1; var basePet4Chance = 0.05; var finalPetChance = basePetChance; var finalPet1Chance = basePet1Chance; var finalPet2Chance = basePet2Chance; var finalPet3Chance = basePet3Chance * luckMultiplier; var finalPet4Chance = basePet4Chance * luckMultiplier; if (petCount > 0) { petDisplay.visible = true; petCountText.visible = true; petCountText.setText(formatNumber(petCount) + 'x'); petChanceText.visible = true; petChanceText.setText(formatNumber(finalPetChance) + '%'); petBoostText.visible = true; petBoostText.setText('Win boost = ' + formatNumber(petCount * 0.02)); petMuscleBoostText.visible = true; petMuscleBoostText.setText('Muscle boost = ' + formatNumber(petCount * 0.01)); } if (pet1Count > 0) { pet1Display.visible = true; pet1CountText.visible = true; pet1CountText.setText(formatNumber(pet1Count) + 'x'); pet1ChanceText.visible = true; pet1ChanceText.setText(formatNumber(finalPet1Chance) + '%'); pet1BoostText.visible = true; pet1BoostText.setText('Win boost = ' + formatNumber(pet1Count * 0.06)); pet1MuscleBoostText.visible = true; pet1MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet1Count * 0.03)); } if (pet2Count > 0) { pet2Display.visible = true; pet2CountText.visible = true; pet2CountText.setText(formatNumber(pet2Count) + 'x'); pet2ChanceText.visible = true; pet2ChanceText.setText(formatNumber(finalPet2Chance) + '%'); pet2BoostText.visible = true; pet2BoostText.setText('Win boost = ' + formatNumber(pet2Count * 0.2)); pet2MuscleBoostText.visible = true; pet2MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet2Count * 0.1)); } if (pet3Count > 0) { pet3Display.visible = true; pet3CountText.visible = true; pet3CountText.setText(formatNumber(pet3Count) + 'x'); pet3ChanceText.visible = true; pet3ChanceText.setText(formatNumber(finalPet3Chance) + '%'); pet3BoostText.visible = true; pet3BoostText.setText('Win boost = ' + formatNumber(pet3Count * 1.5)); pet3MuscleBoostText.visible = true; pet3MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet3Count * 0.75)); } if (pet4Count > 0) { pet4Display.visible = true; pet4CountText.visible = true; pet4CountText.setText(formatNumber(pet4Count) + 'x'); pet4ChanceText.visible = true; pet4ChanceText.setText(formatNumber(finalPet4Chance) + '%'); pet4BoostText.visible = true; pet4BoostText.setText('Win boost = ' + formatNumber(pet4Count * 60)); pet4MuscleBoostText.visible = true; pet4MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet4Count * 30)); } // Always show rich_water_melon or achievements_1b_win with all text var hiddenPetMultiplier = 1 + luckBoost * 0.25; var hiddenPetChance = 0.000075 * hiddenPetMultiplier; if (richWaterMelonCount > 0) { // Show rich_water_melon since we have it richWaterMelonDisplay.visible = true; richWaterMelonCountText.visible = true; richWaterMelonCountText.setText(formatNumber(richWaterMelonCount) + 'x'); richWaterMelonChanceText.visible = true; richWaterMelonChanceText.setText(hiddenPetChance.toFixed(6) + '%'); richWaterMelonBoostText.visible = true; } else { // Show achievements_1b_win as placeholder achievementsDisplay.visible = true; achievementsCountText.visible = true; achievementsCountText.setText(hiddenPetChance.toFixed(6) + '%'); achievementsInfoText.visible = true; achievementsInfoText.setText('All secret pets 5x'); } } else if (currentInventoryPage === 2) { // Page 2: Show new pets (pet5-pet9 and petSecret) // Calculate dynamic chances with luck boost for page 2 pets var luckMultiplier = 1 + luckBoost * 0.25; var basePet5Chance = Math.max(0, 50 * Math.pow(0.90, luckBoost)); // Pet5 decreases by 10% var basePet6Chance = Math.max(0, 20 * Math.pow(0.925, luckBoost)); // Pet6 decreases by 7.5% var basePet7Chance = 5 * luckMultiplier; // Pet7 increases by 25% var basePet8Chance = 1 * luckMultiplier; // Pet8 increases by 25% var basePet9Chance = 0.06 * luckMultiplier; // Pet9 increases by 25% var basePetSecretChance = 0.0001 * luckMultiplier; // Secret increases by 25% // Always show all pets on page 2 with correct assets and all text // Pet5 - always show with text if (pet5Count > 0) { // Change to actual pet5 asset since we have at least one pet5Display.removeChildren(); pet5Display.addChild(LK.getAsset('pet5', { anchorX: 0.5, anchorY: 0.5 })); } else { // Use _D asset since we don't have any pet5Display.removeChildren(); pet5Display.addChild(LK.getAsset('pet5_D', { anchorX: 0.5, anchorY: 0.5 })); } pet5Display.visible = true; pet5CountText.visible = true; pet5CountText.setText(formatNumber(pet5Count) + 'x'); pet5ChanceText.visible = true; pet5ChanceText.setText(formatNumber(basePet5Chance) + '%'); pet5BoostText.visible = true; pet5BoostText.setText('Win boost = ' + formatNumber(pet5Count * 0.1)); pet5MuscleBoostText.visible = true; pet5MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet5Count * 0.07)); // Pet6 - always show with text if (pet6Count > 0) { // Change to actual pet6 asset since we have at least one pet6Display.removeChildren(); pet6Display.addChild(LK.getAsset('pet6', { anchorX: 0.5, anchorY: 0.5 })); } else { // Use _D asset since we don't have any pet6Display.removeChildren(); pet6Display.addChild(LK.getAsset('pet6_D', { anchorX: 0.5, anchorY: 0.5 })); } pet6Display.visible = true; pet6CountText.visible = true; pet6CountText.setText(formatNumber(pet6Count) + 'x'); pet6ChanceText.visible = true; pet6ChanceText.setText(formatNumber(basePet6Chance) + '%'); pet6BoostText.visible = true; pet6BoostText.setText('Win boost = ' + formatNumber(pet6Count * 0.4)); pet6MuscleBoostText.visible = true; pet6MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet6Count * 0.2)); // Pet7 - always show with text if (pet7Count > 0) { // Change to actual pet7 asset since we have at least one pet7Display.removeChildren(); pet7Display.addChild(LK.getAsset('pet7', { anchorX: 0.5, anchorY: 0.5 })); } else { // Use _D asset since we don't have any pet7Display.removeChildren(); pet7Display.addChild(LK.getAsset('pet7_D', { anchorX: 0.5, anchorY: 0.5 })); } pet7Display.visible = true; pet7CountText.visible = true; pet7CountText.setText(formatNumber(pet7Count) + 'x'); pet7ChanceText.visible = true; pet7ChanceText.setText(formatNumber(basePet7Chance) + '%'); pet7BoostText.visible = true; pet7BoostText.setText('Win boost = ' + formatNumber(pet7Count * 2)); pet7MuscleBoostText.visible = true; pet7MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet7Count * 1.2)); // Pet8 - always show with text if (pet8Count > 0) { // Change to actual pet8 asset since we have at least one pet8Display.removeChildren(); pet8Display.addChild(LK.getAsset('pet8', { anchorX: 0.5, anchorY: 0.5 })); } else { // Use _D asset since we don't have any pet8Display.removeChildren(); pet8Display.addChild(LK.getAsset('pet8_D', { anchorX: 0.5, anchorY: 0.5 })); } pet8Display.visible = true; pet8CountText.visible = true; pet8CountText.setText(formatNumber(pet8Count) + 'x'); pet8ChanceText.visible = true; pet8ChanceText.setText(formatNumber(basePet8Chance) + '%'); pet8BoostText.visible = true; pet8BoostText.setText('Win boost = ' + formatNumber(pet8Count * 15)); pet8MuscleBoostText.visible = true; pet8MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet8Count * 10)); // Pet9 - always show with text if (pet9Count > 0) { // Change to actual pet9 asset since we have at least one pet9Display.removeChildren(); pet9Display.addChild(LK.getAsset('pet9', { anchorX: 0.5, anchorY: 0.5 })); } else { // Use _D asset since we don't have any pet9Display.removeChildren(); pet9Display.addChild(LK.getAsset('pet9_D', { anchorX: 0.5, anchorY: 0.5 })); } pet9Display.visible = true; pet9CountText.visible = true; pet9CountText.setText(formatNumber(pet9Count) + 'x'); pet9ChanceText.visible = true; pet9ChanceText.setText(formatNumber(basePet9Chance) + '%'); pet9BoostText.visible = true; pet9BoostText.setText('Win boost = ' + formatNumber(pet9Count * 100)); pet9MuscleBoostText.visible = true; pet9MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet9Count * 85)); // PetSecret - always show with text if (petSecretCount > 0) { // Change to actual petSecret asset since we have at least one petSecretDisplay.removeChildren(); petSecretDisplay.addChild(LK.getAsset('petSecret', { anchorX: 0.5, anchorY: 0.5 })); } else { // Use _D asset since we don't have any petSecretDisplay.removeChildren(); petSecretDisplay.addChild(LK.getAsset('petSecret_D', { anchorX: 0.5, anchorY: 0.5 })); } petSecretDisplay.visible = true; petSecretCountText.visible = true; petSecretCountText.setText(formatNumber(petSecretCount) + 'x'); petSecretChanceText.visible = true; petSecretChanceText.setText(basePetSecretChance.toFixed(6) + '%'); petSecretBoostText.visible = true; petSecretWinBoostText.visible = true; } return; } // Calculate previous page button bounds in screen coordinates var prevPageBounds = { left: guiCenterX + prevPageButton.x - 60, right: guiCenterX + prevPageButton.x + 60, top: guiCenterY + prevPageButton.y - 40, bottom: guiCenterY + prevPageButton.y + 40 }; if (screenX >= prevPageBounds.left && screenX <= prevPageBounds.right && screenY >= prevPageBounds.top && screenY <= prevPageBounds.bottom) { // Switch to previous page currentInventoryPage = currentInventoryPage - 1; if (currentInventoryPage < 1) { currentInventoryPage = maxInventoryPages; // Loop back to last page } // Update page display pageNumberDisplay.setText('Page ' + currentInventoryPage + '/' + maxInventoryPages); // Hide all pet displays first petDisplay.visible = false; pet1Display.visible = false; pet2Display.visible = false; pet3Display.visible = false; pet4Display.visible = false; petCountText.visible = false; pet1CountText.visible = false; pet2CountText.visible = false; pet3CountText.visible = false; pet4CountText.visible = false; petChanceText.visible = false; petBoostText.visible = false; pet1ChanceText.visible = false; pet1BoostText.visible = false; pet2ChanceText.visible = false; pet2BoostText.visible = false; pet3ChanceText.visible = false; pet3BoostText.visible = false; pet4ChanceText.visible = false; pet4BoostText.visible = false; petMuscleBoostText.visible = false; pet1MuscleBoostText.visible = false; pet2MuscleBoostText.visible = false; pet3MuscleBoostText.visible = false; pet4MuscleBoostText.visible = false; // Hide new pet displays pet5Display.visible = false; pet6Display.visible = false; pet7Display.visible = false; pet8Display.visible = false; pet9Display.visible = false; petSecretDisplay.visible = false; pet5CountText.visible = false; pet6CountText.visible = false; pet7CountText.visible = false; pet8CountText.visible = false; pet9CountText.visible = false; petSecretCountText.visible = false; pet5ChanceText.visible = false; pet6ChanceText.visible = false; pet7ChanceText.visible = false; pet8ChanceText.visible = false; pet9ChanceText.visible = false; petSecretChanceText.visible = false; pet5BoostText.visible = false; pet6BoostText.visible = false; pet7BoostText.visible = false; pet8BoostText.visible = false; pet9BoostText.visible = false; petSecretBoostText.visible = false; pet5MuscleBoostText.visible = false; pet6MuscleBoostText.visible = false; pet7MuscleBoostText.visible = false; pet8MuscleBoostText.visible = false; pet9MuscleBoostText.visible = false; petSecretWinBoostText.visible = false; richWaterMelonDisplay.visible = false; richWaterMelonCountText.visible = false; richWaterMelonChanceText.visible = false; richWaterMelonBoostText.visible = false; achievementsDisplay.visible = false; achievementsCountText.visible = false; achievementsInfoText.visible = false; // Show pets based on current page if (currentInventoryPage === 1) { // Page 1: Show all pets (pet, pet1, pet2, pet3, pet4) // Calculate dynamic chances with luck boost var luckMultiplier = 1 + luckBoost * 0.25; var basePetChance = Math.max(0, 70 * Math.pow(0.95, luckBoost)); var basePet1Chance = Math.max(0, 30 * Math.pow(0.96, luckBoost)); var basePet2Chance = Math.max(0, 10 * Math.pow(0.97, luckBoost)); var basePet3Chance = 1; var basePet4Chance = 0.05; var finalPetChance = basePetChance; var finalPet1Chance = basePet1Chance; var finalPet2Chance = basePet2Chance; var finalPet3Chance = basePet3Chance * luckMultiplier; var finalPet4Chance = basePet4Chance * luckMultiplier; if (petCount > 0) { petDisplay.visible = true; petCountText.visible = true; petCountText.setText(formatNumber(petCount) + 'x'); petChanceText.visible = true; petChanceText.setText(formatNumber(finalPetChance) + '%'); petBoostText.visible = true; petBoostText.setText('Win boost = ' + formatNumber(petCount * 0.02)); petMuscleBoostText.visible = true; petMuscleBoostText.setText('Muscle boost = ' + formatNumber(petCount * 0.01)); } if (pet1Count > 0) { pet1Display.visible = true; pet1CountText.visible = true; pet1CountText.setText(formatNumber(pet1Count) + 'x'); pet1ChanceText.visible = true; pet1ChanceText.setText(formatNumber(finalPet1Chance) + '%'); pet1BoostText.visible = true; pet1BoostText.setText('Win boost = ' + formatNumber(pet1Count * 0.06)); pet1MuscleBoostText.visible = true; pet1MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet1Count * 0.03)); } if (pet2Count > 0) { pet2Display.visible = true; pet2CountText.visible = true; pet2CountText.setText(formatNumber(pet2Count) + 'x'); pet2ChanceText.visible = true; pet2ChanceText.setText(formatNumber(finalPet2Chance) + '%'); pet2BoostText.visible = true; pet2BoostText.setText('Win boost = ' + formatNumber(pet2Count * 0.2)); pet2MuscleBoostText.visible = true; pet2MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet2Count * 0.1)); } if (pet3Count > 0) { pet3Display.visible = true; pet3CountText.visible = true; pet3CountText.setText(formatNumber(pet3Count) + 'x'); pet3ChanceText.visible = true; pet3ChanceText.setText(formatNumber(finalPet3Chance) + '%'); pet3BoostText.visible = true; pet3BoostText.setText('Win boost = ' + formatNumber(pet3Count * 1.5)); pet3MuscleBoostText.visible = true; pet3MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet3Count * 0.75)); } if (pet4Count > 0) { pet4Display.visible = true; pet4CountText.visible = true; pet4CountText.setText(formatNumber(pet4Count) + 'x'); pet4ChanceText.visible = true; pet4ChanceText.setText(formatNumber(finalPet4Chance) + '%'); pet4BoostText.visible = true; pet4BoostText.setText('Win boost = ' + formatNumber(pet4Count * 60)); pet4MuscleBoostText.visible = true; pet4MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet4Count * 30)); } // Always show rich_water_melon or achievements_1b_win with all text var hiddenPetMultiplier = 1 + luckBoost * 0.25; var hiddenPetChance = 0.000075 * hiddenPetMultiplier; if (richWaterMelonCount > 0) { // Show rich_water_melon since we have it richWaterMelonDisplay.visible = true; richWaterMelonCountText.visible = true; richWaterMelonCountText.setText(formatNumber(richWaterMelonCount) + 'x'); richWaterMelonChanceText.visible = true; richWaterMelonChanceText.setText(hiddenPetChance.toFixed(6) + '%'); richWaterMelonBoostText.visible = true; } else { // Show achievements_1b_win as placeholder achievementsDisplay.visible = true; achievementsCountText.visible = true; achievementsCountText.setText(hiddenPetChance.toFixed(6) + '%'); achievementsInfoText.visible = true; achievementsInfoText.setText('All secret pets 5x'); } } else if (currentInventoryPage === 2) { // Page 2: Show new pets (pet5-pet9 and petSecret) // Calculate dynamic chances with luck boost for page 2 pets var luckMultiplier = 1 + luckBoost * 0.25; var basePet5Chance = Math.max(0, 50 * Math.pow(0.90, luckBoost)); // Pet5 decreases by 10% var basePet6Chance = Math.max(0, 20 * Math.pow(0.925, luckBoost)); // Pet6 decreases by 7.5% var basePet7Chance = 5 * luckMultiplier; // Pet7 increases by 25% var basePet8Chance = 1 * luckMultiplier; // Pet8 increases by 25% var basePet9Chance = 0.06 * luckMultiplier; // Pet9 increases by 25% var basePetSecretChance = 0.0001 * luckMultiplier; // Secret increases by 25% if (pet5Count > 0) { pet5Display.visible = true; pet5CountText.visible = true; pet5CountText.setText(formatNumber(pet5Count) + 'x'); pet5ChanceText.visible = true; pet5ChanceText.setText(formatNumber(basePet5Chance) + '%'); pet5BoostText.visible = true; pet5BoostText.setText('Win boost = ' + formatNumber(pet5Count * 0.1)); pet5MuscleBoostText.visible = true; pet5MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet5Count * 0.07)); } if (pet6Count > 0) { pet6Display.visible = true; pet6CountText.visible = true; pet6CountText.setText(formatNumber(pet6Count) + 'x'); pet6ChanceText.visible = true; pet6ChanceText.setText(formatNumber(basePet6Chance) + '%'); pet6BoostText.visible = true; pet6BoostText.setText('Win boost = ' + formatNumber(pet6Count * 0.4)); pet6MuscleBoostText.visible = true; pet6MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet6Count * 0.2)); } if (pet7Count > 0) { pet7Display.visible = true; pet7CountText.visible = true; pet7CountText.setText(formatNumber(pet7Count) + 'x'); pet7ChanceText.visible = true; pet7ChanceText.setText(formatNumber(basePet7Chance) + '%'); pet7BoostText.visible = true; pet7BoostText.setText('Win boost = ' + formatNumber(pet7Count * 2)); pet7MuscleBoostText.visible = true; pet7MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet7Count * 1.2)); } if (pet8Count > 0) { pet8Display.visible = true; pet8CountText.visible = true; pet8CountText.setText(formatNumber(pet8Count) + 'x'); pet8ChanceText.visible = true; pet8ChanceText.setText(formatNumber(basePet8Chance) + '%'); pet8BoostText.visible = true; pet8BoostText.setText('Win boost = ' + formatNumber(pet8Count * 15)); pet8MuscleBoostText.visible = true; pet8MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet8Count * 10)); } if (pet9Count > 0) { pet9Display.visible = true; pet9CountText.visible = true; pet9CountText.setText(formatNumber(pet9Count) + 'x'); pet9ChanceText.visible = true; pet9ChanceText.setText(formatNumber(basePet9Chance) + '%'); pet9BoostText.visible = true; pet9BoostText.setText('Win boost = ' + formatNumber(pet9Count * 100)); pet9MuscleBoostText.visible = true; pet9MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet9Count * 85)); } if (petSecretCount > 0) { petSecretDisplay.visible = true; petSecretCountText.visible = true; petSecretCountText.setText(formatNumber(petSecretCount) + 'x'); petSecretChanceText.visible = true; petSecretChanceText.setText(basePetSecretChance.toFixed(6) + '%'); petSecretBoostText.visible = true; petSecretWinBoostText.visible = true; } } return; } return; } // Check if shop UI is open if (isShopOpen) { // Check if close button was clicked (convert screen coordinates to GUI coordinates) var screenY = y * (LK.gui.height / 2732); var screenX = x * (LK.gui.width / 2048); var guiCenterX = LK.gui.width / 2; var guiCenterY = LK.gui.height / 2; // Calculate close button bounds in screen coordinates var closeBounds = { left: guiCenterX + closeButton.x - 50, right: guiCenterX + closeButton.x + 50, top: guiCenterY + closeButton.y - 50, bottom: guiCenterY + closeButton.y + 50 }; if (screenX >= closeBounds.left && screenX <= closeBounds.right && screenY >= closeBounds.top && screenY <= closeBounds.bottom) { // Close shop isShopOpen = false; shoppingImage.visible = false; closeButton.visible = false; shopUpgradeText.visible = false; luckUpgradeText.visible = false; return; } // Calculate shop upgrade text bounds in screen coordinates var upgradeBounds = { left: guiCenterX - 200, // Approximate text width bounds right: guiCenterX + 200, top: guiCenterY + shopUpgradeText.y - 30, // Approximate text height bounds bottom: guiCenterY + shopUpgradeText.y + 30 }; if (screenX >= upgradeBounds.left && screenX <= upgradeBounds.right && screenY >= upgradeBounds.top && screenY <= upgradeBounds.bottom) { // Check if player has enough muscle to buy upgrade if (muscle >= shopPrice) { // Deduct muscle and add boost muscle = Math.round((muscle - shopPrice) * 10) / 10; // Always add the base boost amount (1.5) muscleBoost = Math.round((muscleBoost + shopBoostAmount) * 10) / 10; // Multiply the price by 1.5x for next upgrade shopPrice = Math.round(shopPrice * 1.5); // Save to storage storage.muscle = muscle; storage.muscleBoost = muscleBoost; storage.shopPrice = shopPrice; // Update shop text - show the next boost amount that will be added (always 1.5) shopUpgradeText.setText(formatNumber(shopPrice) + ' muscle = + ' + formatNumber(shopBoostAmount) + ' muscle boost'); // Update muscle boost display muscleBoostDisplay.setText('Muscle Boost: ' + formatNumber(muscleBoost + totalPetMuscleBoost)); } return; } // Calculate luck upgrade text bounds in screen coordinates var luckUpgradeBounds = { left: guiCenterX - 200, right: guiCenterX + 200, top: guiCenterY + luckUpgradeText.y - 30, bottom: guiCenterY + luckUpgradeText.y + 30 }; if (screenX >= luckUpgradeBounds.left && screenX <= luckUpgradeBounds.right && screenY >= luckUpgradeBounds.top && screenY <= luckUpgradeBounds.bottom) { // Check if player has enough wins to buy luck boost if (win >= luckPrice) { // Deduct wins and add luck boost win -= luckPrice; luckBoost += 1; // Multiply the price by 10x for next upgrade luckPrice = luckPrice * 10; // Save to storage storage.win = win; storage.luckBoost = luckBoost; storage.luckPrice = luckPrice; // Update luck upgrade text luckUpgradeText.setText(formatNumber(luckPrice) + ' win = + 1 luck boost'); // Update luck boost display luckBoostDisplay.setText('Luck Boost: ' + formatNumber(luckBoost)); } return; } return; } // Check if shop was clicked (convert screen coordinates to GUI coordinates) var screenY = y * (LK.gui.height / 2732); var screenX = x * (LK.gui.width / 2048); // Calculate shop bounds more accurately for bottom-right position var shopBounds = { left: LK.gui.width + shop.x - shop.width * 0.15, // Account for right anchor and scale right: LK.gui.width + shop.x, top: LK.gui.height + shop.y - shop.height * 0.15, // Account for anchor and scale bottom: LK.gui.height + shop.y }; if (screenX >= shopBounds.left && screenX <= shopBounds.right && screenY >= shopBounds.top && screenY <= shopBounds.bottom) { // Open shop (don't toggle, only open) if (!isShopOpen) { isShopOpen = true; shoppingImage.visible = true; closeButton.visible = true; shopUpgradeText.visible = true; luckUpgradeText.visible = true; // Update shop upgrade text with current values - show the next boost amount (always 1.5) shopUpgradeText.setText(formatNumber(shopPrice) + ' muscle = + ' + formatNumber(shopBoostAmount) + ' muscle boost'); // Update luck upgrade text with current values luckUpgradeText.setText(formatNumber(luckPrice) + ' win = + 1 luck boost'); } return; } // Check if egg was clicked var eggLeft = egg.x - 75; var eggRight = egg.x + 75; var eggTop = egg.y - 75; var eggBottom = egg.y + 75; if (x >= eggLeft && x <= eggRight && y >= eggTop && y <= eggBottom && win >= 200) { // Deduct 200 win points win -= 200; storage.win = win; // Pet chances with luck boost and cascading decrease system var luckMultiplier = 1 + luckBoost * 0.25; // Hidden pet chance (rich_water_melon) - 0.000075% base chance, increased by 25% per luck boost var hiddenPetChance = 0.000075 * luckMultiplier; // Pet (first pet) decreases by 5% per luck boost from base 70%, can reach 0 var basePetChance = Math.max(0, 70 * Math.pow(0.95, luckBoost)); // Pet1 decreases by 4% per luck boost from base 30%, can reach 0 var basePet1Chance = Math.max(0, 30 * Math.pow(0.96, luckBoost)); // Pet2 decreases by 3% per luck boost from base 10%, can reach 0 var basePet2Chance = Math.max(0, 10 * Math.pow(0.97, luckBoost)); // Pet3 and Pet4 always increase with luck boost, never decrease var basePet3Chance = 1; var basePet4Chance = 0.05; // For pets that decrease, don't apply luck multiplier, just use base values var petChance = basePetChance; var pet1Chance = basePet1Chance; var pet2Chance = basePet2Chance; var pet3Chance = basePet3Chance * luckMultiplier; var pet4Chance = basePet4Chance * luckMultiplier; var random = Math.random() * 100; // Convert to percentage // Create egg result display that always shows var eggResultDisplay; if (random < hiddenPetChance) { // Got hidden pet (rich_water_melon) - increases all hidden pet chances by 500% (5x) var richWaterMelonCount = storage.richWaterMelonCount || 0; richWaterMelonCount += 1; storage.richWaterMelonCount = richWaterMelonCount; // Show rich_water_melon asset since we got it eggResultDisplay = game.addChild(LK.getAsset('rich_water_melon', { anchorX: 0.5, anchorY: 0.5 })); } else if (random < hiddenPetChance + pet4Chance) { // Got pet4 pet4Count += 1; storage.pet4Count = pet4Count; // Show achievements_1b_win since we didn't get rich_water_melon eggResultDisplay = game.addChild(LK.getAsset('achievements_1b_win', { anchorX: 0.5, anchorY: 0.5 })); } else if (random < hiddenPetChance + pet4Chance + pet3Chance) { // Got pet3 pet3Count += 1; storage.pet3Count = pet3Count; // Show achievements_1b_win since we didn't get rich_water_melon eggResultDisplay = game.addChild(LK.getAsset('achievements_1b_win', { anchorX: 0.5, anchorY: 0.5 })); } else if (random < hiddenPetChance + pet4Chance + pet3Chance + pet2Chance) { // Got pet2 pet2Count += 1; storage.pet2Count = pet2Count; // Show achievements_1b_win since we didn't get rich_water_melon eggResultDisplay = game.addChild(LK.getAsset('achievements_1b_win', { anchorX: 0.5, anchorY: 0.5 })); } else if (random < hiddenPetChance + pet4Chance + pet3Chance + pet2Chance + pet1Chance) { // Got pet1 pet1Count += 1; storage.pet1Count = pet1Count; // Show achievements_1b_win since we didn't get rich_water_melon eggResultDisplay = game.addChild(LK.getAsset('achievements_1b_win', { anchorX: 0.5, anchorY: 0.5 })); } else { // Got pet (remaining chance) petCount += 1; storage.petCount = petCount; // Show achievements_1b_win since we didn't get rich_water_melon eggResultDisplay = game.addChild(LK.getAsset('achievements_1b_win', { anchorX: 0.5, anchorY: 0.5 })); } // Position the result display at egg location and make it temporary eggResultDisplay.x = egg.x; eggResultDisplay.y = egg.y; // Remove the display after 2 seconds LK.setTimeout(function () { if (eggResultDisplay && eggResultDisplay.parent) { eggResultDisplay.destroy(); } }, 2000); // Recalculate win boost values petWinBoost = petCount * 0.02; pet1WinBoost = pet1Count * 0.06; pet2WinBoost = pet2Count * 0.2; pet3WinBoost = pet3Count * 1.5; pet4WinBoost = pet4Count * 60; totalWinBoost = petWinBoost + pet1WinBoost + pet2WinBoost + pet3WinBoost + pet4WinBoost; // Recalculate pet muscle boost values petMuscleBoost = petCount * 0.01; pet1MuscleBoost = pet1Count * 0.03; pet2MuscleBoost = pet2Count * 0.1; pet3MuscleBoost = pet3Count * 0.75; pet4MuscleBoost = pet4Count * 30; totalPetMuscleBoost = petMuscleBoost + pet1MuscleBoost + pet2MuscleBoost + pet3MuscleBoost + pet4MuscleBoost; // Update win boost display winBoostDisplay.setText('Win Boost: ' + formatNumber(totalWinBoost)); // Update muscle boost display muscleBoostDisplay.setText('Muscle Boost: ' + formatNumber(muscleBoost + totalPetMuscleBoost)); return; } // Check if egg2 was clicked var egg2Left = egg2.x - 75; var egg2Right = egg2.x + 75; var egg2Top = egg2.y - 75; var egg2Bottom = egg2.y + 75; if (x >= egg2Left && x <= egg2Right && y >= egg2Top && y <= egg2Bottom && win >= 5000) { // Deduct 5000 win points win -= 5000; storage.win = win; // Pet chances for egg2 with luck boost effects var luckMultiplier = 1 + luckBoost * 0.25; // Apply 5x multiplier to all hidden pet chances if rich water melon is owned var hiddenPetMultiplier = richWaterMelonCount > 0 ? 5 : 1; var basePet5Chance = Math.max(0, 50 * Math.pow(0.90, luckBoost)); // Pet5 decreases by 10% var basePet6Chance = Math.max(0, 20 * Math.pow(0.925, luckBoost)); // Pet6 decreases by 7.5% var basePet7Chance = 5 * luckMultiplier * hiddenPetMultiplier; // Pet7 increases by 25% and 5x if rich water melon owned var basePet8Chance = 1 * luckMultiplier * hiddenPetMultiplier; // Pet8 increases by 25% and 5x if rich water melon owned var basePet9Chance = 0.06 * luckMultiplier * hiddenPetMultiplier; // Pet9 increases by 25% and 5x if rich water melon owned var basePetSecretChance = 0.0001 * luckMultiplier * hiddenPetMultiplier; // Secret increases by 25% and 5x if rich water melon owned var random = Math.random() * 100; // Convert to percentage if (random < basePetSecretChance) { // Got secret pet petSecretCount += 1; storage.petSecretCount = petSecretCount; } else if (random < basePetSecretChance + basePet9Chance) { // Got pet9 pet9Count += 1; storage.pet9Count = pet9Count; } else if (random < basePetSecretChance + basePet9Chance + basePet8Chance) { // Got pet8 pet8Count += 1; storage.pet8Count = pet8Count; } else if (random < basePetSecretChance + basePet9Chance + basePet8Chance + basePet7Chance) { // Got pet7 pet7Count += 1; storage.pet7Count = pet7Count; } else if (random < basePetSecretChance + basePet9Chance + basePet8Chance + basePet7Chance + basePet6Chance) { // Got pet6 pet6Count += 1; storage.pet6Count = pet6Count; } else { // Got pet5 (remaining chance) pet5Count += 1; storage.pet5Count = pet5Count; } // Recalculate win boost values including new pets petWinBoost = petCount * 0.02; pet1WinBoost = pet1Count * 0.06; pet2WinBoost = pet2Count * 0.2; pet3WinBoost = pet3Count * 1.5; pet4WinBoost = pet4Count * 60; pet5WinBoost = pet5Count * 0.1; pet6WinBoost = pet6Count * 0.4; pet7WinBoost = pet7Count * 2; pet8WinBoost = pet8Count * 15; pet9WinBoost = pet9Count * 100; petSecretWinBoost = petSecretCount > 0 ? (petWinBoost + pet1WinBoost + pet2WinBoost + pet3WinBoost + pet4WinBoost + pet5WinBoost + pet6WinBoost + pet7WinBoost + pet8WinBoost + pet9WinBoost) * 5 : 0; totalWinBoost = petWinBoost + pet1WinBoost + pet2WinBoost + pet3WinBoost + pet4WinBoost + pet5WinBoost + pet6WinBoost + pet7WinBoost + pet8WinBoost + pet9WinBoost + petSecretWinBoost; // Recalculate pet muscle boost values including new pets petMuscleBoost = petCount * 0.01; pet1MuscleBoost = pet1Count * 0.03; pet2MuscleBoost = pet2Count * 0.1; pet3MuscleBoost = pet3Count * 0.75; pet4MuscleBoost = pet4Count * 30; pet5MuscleBoost = pet5Count * 0.07; pet6MuscleBoost = pet6Count * 0.2; pet7MuscleBoost = pet7Count * 1.2; pet8MuscleBoost = pet8Count * 10; pet9MuscleBoost = pet9Count * 85; petSecretMuscleBoost = petSecretCount > 0 ? (petMuscleBoost + pet1MuscleBoost + pet2MuscleBoost + pet3MuscleBoost + pet4MuscleBoost + pet5MuscleBoost + pet6MuscleBoost + pet7MuscleBoost + pet8MuscleBoost + pet9MuscleBoost) * 5 : 0; totalPetMuscleBoost = petMuscleBoost + pet1MuscleBoost + pet2MuscleBoost + pet3MuscleBoost + pet4MuscleBoost + pet5MuscleBoost + pet6MuscleBoost + pet7MuscleBoost + pet8MuscleBoost + pet9MuscleBoost + petSecretMuscleBoost; // Update win boost display winBoostDisplay.setText('Win Boost: ' + formatNumber(totalWinBoost)); // Update muscle boost display muscleBoostDisplay.setText('Muscle Boost: ' + formatNumber(muscleBoost + totalPetMuscleBoost)); return; } // Check if admin panel was clicked var adminPanelBounds = { left: LK.gui.width + adminPanel.x - adminPanel.width, right: LK.gui.width + adminPanel.x, top: LK.gui.height + adminPanel.y - adminPanel.height, bottom: LK.gui.height + adminPanel.y }; if (screenX >= adminPanelBounds.left && screenX <= adminPanelBounds.right && screenY >= adminPanelBounds.top && screenY <= adminPanelBounds.bottom) { // Show code prompt if (!isCodePromptActive) { isCodePromptActive = true; currentInputCode = ''; adminCodePrompt.visible = true; adminCodePrompt.setText('Enter Code: ' + currentInputCode); // Show number buttons for (var showIndex = 0; showIndex < numberButtons.length; showIndex++) { numberButtons[showIndex].visible = true; } } return; } // Handle admin panel interactions when open if (isAdminOpen) { // Check if close button was clicked var adminCloseButtonBounds = { left: guiCenterX + adminCloseButton.x - 65, right: guiCenterX + adminCloseButton.x + 65, top: guiCenterY + adminCloseButton.y - 65, bottom: guiCenterY + adminCloseButton.y + 65 }; if (screenX >= adminCloseButtonBounds.left && screenX <= adminCloseButtonBounds.right && screenY >= adminCloseButtonBounds.top && screenY <= adminCloseButtonBounds.bottom) { // Close admin panel isAdminOpen = false; isAdminInputMode = false; adminPanelUI.visible = false; adminCloseButton.visible = false; adminMuscleText.visible = false; adminWinText.visible = false; adminLuckText.visible = false; adminEnterButton.visible = false; adminDeleteButton.visible = false; adminCodePrompt.visible = false; // Hide number buttons for (var hideIndex = 0; hideIndex < numberButtons.length; hideIndex++) { numberButtons[hideIndex].visible = false; } return; } // Handle admin input mode if (isAdminInputMode) { // Check enter button var adminEnterBounds = { left: guiCenterX + adminEnterButton.x - 40, right: guiCenterX + adminEnterButton.x + 40, top: guiCenterY + adminEnterButton.y - 40, bottom: guiCenterY + adminEnterButton.y + 40 }; if (screenX >= adminEnterBounds.left && screenX <= adminEnterBounds.right && screenY >= adminEnterBounds.top && screenY <= adminEnterBounds.bottom) { // Apply the value var newValue = parseInt(adminCurrentValue); if (!isNaN(newValue)) { if (adminInputType === 'muscle') { muscle = newValue; storage.muscle = muscle; } else if (adminInputType === 'win') { win = newValue; storage.win = win; } else if (adminInputType === 'luck') { luckBoost = newValue; storage.luckBoost = luckBoost; luckBoostDisplay.setText('Luck Boost: ' + formatNumber(luckBoost)); } } // Exit input mode isAdminInputMode = false; adminCurrentValue = ''; adminCodePrompt.visible = false; adminEnterButton.visible = false; adminDeleteButton.visible = false; // Hide number buttons for (var hideIndex = 0; hideIndex < numberButtons.length; hideIndex++) { numberButtons[hideIndex].visible = false; } return; } // Check delete button var adminDeleteBounds = { left: guiCenterX + adminDeleteButton.x - 40, right: guiCenterX + adminDeleteButton.x + 40, top: guiCenterY + adminDeleteButton.y - 40, bottom: guiCenterY + adminDeleteButton.y + 40 }; if (screenX >= adminDeleteBounds.left && screenX <= adminDeleteBounds.right && screenY >= adminDeleteBounds.top && screenY <= adminDeleteBounds.bottom) { // Remove last character if (adminCurrentValue.length > 0) { adminCurrentValue = adminCurrentValue.slice(0, -1); adminCodePrompt.setText('Enter value: ' + adminCurrentValue); } return; } // Check number buttons for input for (var buttonIndex = 0; buttonIndex < numberButtons.length; buttonIndex++) { var button = numberButtons[buttonIndex]; var buttonBounds = { left: guiCenterX + button.x - 40, right: guiCenterX + button.x + 40, top: guiCenterY + button.y - 40, bottom: guiCenterY + button.y + 40 }; if (screenX >= buttonBounds.left && screenX <= buttonBounds.right && screenY >= buttonBounds.top && screenY <= buttonBounds.bottom) { // Add number to value adminCurrentValue += buttonIndex.toString(); adminCodePrompt.setText('Enter value: ' + adminCurrentValue); return; } } } else { // Check if muscle text was clicked var adminMuscleBounds = { left: guiCenterX - 150, right: guiCenterX + 150, top: guiCenterY + adminMuscleText.y - 30, bottom: guiCenterY + adminMuscleText.y + 30 }; if (screenX >= adminMuscleBounds.left && screenX <= adminMuscleBounds.right && screenY >= adminMuscleBounds.top && screenY <= adminMuscleBounds.bottom) { // Enter input mode for muscle isAdminInputMode = true; adminInputType = 'muscle'; adminCurrentValue = ''; adminCodePrompt.visible = true; adminCodePrompt.setText('Enter value: '); adminEnterButton.visible = true; adminDeleteButton.visible = true; // Show number buttons for (var showIndex = 0; showIndex < numberButtons.length; showIndex++) { numberButtons[showIndex].visible = true; } return; } // Check if win text was clicked var adminWinBounds = { left: guiCenterX - 150, right: guiCenterX + 150, top: guiCenterY + adminWinText.y - 30, bottom: guiCenterY + adminWinText.y + 30 }; if (screenX >= adminWinBounds.left && screenX <= adminWinBounds.right && screenY >= adminWinBounds.top && screenY <= adminWinBounds.bottom) { // Enter input mode for win isAdminInputMode = true; adminInputType = 'win'; adminCurrentValue = ''; adminCodePrompt.visible = true; adminCodePrompt.setText('Enter value: '); adminEnterButton.visible = true; adminDeleteButton.visible = true; // Show number buttons for (var showIndex = 0; showIndex < numberButtons.length; showIndex++) { numberButtons[showIndex].visible = true; } return; } // Check if luck boost text was clicked var adminLuckBounds = { left: guiCenterX - 150, right: guiCenterX + 150, top: guiCenterY + adminLuckText.y - 30, bottom: guiCenterY + adminLuckText.y + 30 }; if (screenX >= adminLuckBounds.left && screenX <= adminLuckBounds.right && screenY >= adminLuckBounds.top && screenY <= adminLuckBounds.bottom) { // Enter input mode for luck boost isAdminInputMode = true; adminInputType = 'luck'; adminCurrentValue = ''; adminCodePrompt.visible = true; adminCodePrompt.setText('Enter value: '); adminEnterButton.visible = true; adminDeleteButton.visible = true; // Show number buttons for (var showIndex = 0; showIndex < numberButtons.length; showIndex++) { numberButtons[showIndex].visible = true; } return; } } return; } // Handle code prompt interactions if (isCodePromptActive) { // Check which number button was clicked for (var buttonIndex = 0; buttonIndex < numberButtons.length; buttonIndex++) { var button = numberButtons[buttonIndex]; var buttonBounds = { left: guiCenterX + button.x - 40, right: guiCenterX + button.x + 40, top: guiCenterY + button.y - 40, bottom: guiCenterY + button.y + 40 }; if (screenX >= buttonBounds.left && screenX <= buttonBounds.right && screenY >= buttonBounds.top && screenY <= buttonBounds.bottom) { // Button clicked - add number to code currentInputCode += buttonIndex.toString(); adminCodePrompt.setText('Enter Code: ' + currentInputCode); if (currentInputCode.length >= 6) { // Check if code matches if (currentInputCode === adminCode) { // Correct code - open admin panel isCodePromptActive = false; isAdminOpen = true; adminCodePrompt.visible = false; // Hide number buttons for (var hideIndex = 0; hideIndex < numberButtons.length; hideIndex++) { numberButtons[hideIndex].visible = false; } adminPanelUI.visible = true; adminCloseButton.visible = true; adminMuscleText.visible = true; adminWinText.visible = true; adminLuckText.visible = true; // Update display values adminMuscleText.setText('Muscle'); adminWinText.setText('Win'); adminLuckText.setText('Luck Boost'); } else { // Wrong code - reset isCodePromptActive = false; adminCodePrompt.visible = false; // Hide number buttons for (var hideIndex = 0; hideIndex < numberButtons.length; hideIndex++) { numberButtons[hideIndex].visible = false; } currentInputCode = ''; } } return; } } return; } // Check if inventory was clicked (convert screen coordinates to GUI coordinates) var inventoryBounds = { left: LK.gui.width + inventory.x - inventory.width * 0.15, right: LK.gui.width + inventory.x, top: LK.gui.height + inventory.y - inventory.height * 0.15, bottom: LK.gui.height + inventory.y }; if (screenX >= inventoryBounds.left && screenX <= inventoryBounds.right && screenY >= inventoryBounds.top && screenY <= inventoryBounds.bottom) { // Open inventory (don't toggle, only open) if (!isInventoryOpen) { isInventoryOpen = true; currentInventoryPage = 1; // Reset to first page when opening inInventoryImage.visible = true; close1Button.visible = true; nextPageButton.visible = true; prevPageButton.visible = true; pageNumberDisplay.visible = true; pageNumberDisplay.setText('Page 1/2'); // Calculate dynamic chances with luck boost var luckMultiplier = 1 + luckBoost * 0.25; // Pet (first pet) decreases by 5% per luck boost from base 70%, can reach 0 var basePetChance = Math.max(0, 70 * Math.pow(0.95, luckBoost)); // Pet1 decreases by 4% per luck boost from base 30%, can reach 0 var basePet1Chance = Math.max(0, 30 * Math.pow(0.96, luckBoost)); // Pet2 decreases by 3% per luck boost from base 10%, can reach 0 var basePet2Chance = Math.max(0, 10 * Math.pow(0.97, luckBoost)); // Pet3 and Pet4 always increase with luck boost, never decrease var basePet3Chance = 1; var basePet4Chance = 0.05; // For pets that decrease, don't apply luck multiplier, just use base values var finalPetChance = basePetChance; var finalPet1Chance = basePet1Chance; var finalPet2Chance = basePet2Chance; var finalPet3Chance = basePet3Chance * luckMultiplier; var finalPet4Chance = basePet4Chance * luckMultiplier; // Always show all pets on page 1 with correct assets and all text // Pet (first pet) - always show with text if (petCount > 0) { // Change to actual pet asset since we have at least one petDisplay.removeChildren(); petDisplay.addChild(LK.getAsset('pet', { anchorX: 0.5, anchorY: 0.5 })); } else { // Use _D asset since we don't have any petDisplay.removeChildren(); petDisplay.addChild(LK.getAsset('pet_D', { anchorX: 0.5, anchorY: 0.5 })); } petDisplay.visible = true; petCountText.visible = true; petCountText.setText(formatNumber(petCount) + 'x'); petChanceText.visible = true; petChanceText.setText(formatNumber(finalPetChance) + '%'); petBoostText.visible = true; petBoostText.setText('Win boost = ' + formatNumber(petCount * 0.02)); petMuscleBoostText.visible = true; petMuscleBoostText.setText('Muscle boost = ' + formatNumber(petCount * 0.01)); // Pet1 - always show with text if (pet1Count > 0) { // Change to actual pet1 asset since we have at least one pet1Display.removeChildren(); pet1Display.addChild(LK.getAsset('pet1', { anchorX: 0.5, anchorY: 0.5 })); } else { // Use _D asset since we don't have any pet1Display.removeChildren(); pet1Display.addChild(LK.getAsset('pet1_D', { anchorX: 0.5, anchorY: 0.5 })); } pet1Display.visible = true; pet1CountText.visible = true; pet1CountText.setText(formatNumber(pet1Count) + 'x'); pet1ChanceText.visible = true; pet1ChanceText.setText(formatNumber(finalPet1Chance) + '%'); pet1BoostText.visible = true; pet1BoostText.setText('Win boost = ' + formatNumber(pet1Count * 0.06)); pet1MuscleBoostText.visible = true; pet1MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet1Count * 0.03)); // Pet2 - always show with text if (pet2Count > 0) { // Change to actual pet2 asset since we have at least one pet2Display.removeChildren(); pet2Display.addChild(LK.getAsset('pet2', { anchorX: 0.5, anchorY: 0.5 })); } else { // Use _D asset since we don't have any pet2Display.removeChildren(); pet2Display.addChild(LK.getAsset('pet2_D', { anchorX: 0.5, anchorY: 0.5 })); } pet2Display.visible = true; pet2CountText.visible = true; pet2CountText.setText(formatNumber(pet2Count) + 'x'); pet2ChanceText.visible = true; pet2ChanceText.setText(formatNumber(finalPet2Chance) + '%'); pet2BoostText.visible = true; pet2BoostText.setText('Win boost = ' + formatNumber(pet2Count * 0.2)); pet2MuscleBoostText.visible = true; pet2MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet2Count * 0.1)); // Pet3 - always show with text if (pet3Count > 0) { // Change to actual pet3 asset since we have at least one pet3Display.removeChildren(); pet3Display.addChild(LK.getAsset('pet3', { anchorX: 0.5, anchorY: 0.5 })); } else { // Use _D asset since we don't have any pet3Display.removeChildren(); pet3Display.addChild(LK.getAsset('pet3_D', { anchorX: 0.5, anchorY: 0.5 })); } pet3Display.visible = true; pet3CountText.visible = true; pet3CountText.setText(formatNumber(pet3Count) + 'x'); pet3ChanceText.visible = true; pet3ChanceText.setText(formatNumber(finalPet3Chance) + '%'); pet3BoostText.visible = true; pet3BoostText.setText('Win boost = ' + formatNumber(pet3Count * 1.5)); pet3MuscleBoostText.visible = true; pet3MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet3Count * 0.75)); // Pet4 - always show with text if (pet4Count > 0) { // Change to actual pet4 asset since we have at least one pet4Display.removeChildren(); pet4Display.addChild(LK.getAsset('pet4', { anchorX: 0.5, anchorY: 0.5 })); } else { // Use _D asset since we don't have any pet4Display.removeChildren(); pet4Display.addChild(LK.getAsset('pet4_D', { anchorX: 0.5, anchorY: 0.5 })); } pet4Display.visible = true; pet4CountText.visible = true; pet4CountText.setText(formatNumber(pet4Count) + 'x'); pet4ChanceText.visible = true; pet4ChanceText.setText(formatNumber(finalPet4Chance) + '%'); pet4BoostText.visible = true; pet4BoostText.setText('Win boost = ' + formatNumber(pet4Count * 60)); pet4MuscleBoostText.visible = true; pet4MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet4Count * 30)); // Always show rich_water_melon or achievements_1b_win with all text var hiddenPetMultiplier = 1 + luckBoost * 0.25; var hiddenPetChance = 0.000075 * hiddenPetMultiplier; if (richWaterMelonCount > 0) { // Show rich_water_melon since we have it richWaterMelonDisplay.visible = true; richWaterMelonCountText.visible = true; richWaterMelonCountText.setText(formatNumber(richWaterMelonCount) + 'x'); richWaterMelonChanceText.visible = true; richWaterMelonChanceText.setText(hiddenPetChance.toFixed(6) + '%'); richWaterMelonBoostText.visible = true; } else { // Show achievements_1b_win as placeholder achievementsDisplay.visible = true; achievementsCountText.visible = true; achievementsCountText.setText(hiddenPetChance.toFixed(6) + '%'); achievementsInfoText.visible = true; achievementsInfoText.setText('All secret pets 5x'); } } return; } // Enemy click delay tracking var enemyLastClickTime = 0; var enemy1LastClickTime = 0; var enemy2LastClickTime = 0; var enemy3LastClickTime = 0; // Check if enemy was clicked and character has muscle >= 10 var enemyLeft = enemy.x - 100; var enemyRight = enemy.x + 100; var enemyTop = enemy.y - 100; var enemyBottom = enemy.y + 100; if (x >= enemyLeft && x <= enemyRight && y >= enemyTop && y <= enemyBottom && muscle >= 10) { var currentTime = Date.now(); // Check if 0.5 seconds have passed since last click if (currentTime - enemyLastClickTime >= 500) { enemyLastClickTime = currentTime; // Wait 0.5 seconds then increment win LK.setTimeout(function () { win = formatWin(win + 1 + totalWinBoost); storage.win = win; }, 500); // 0.5 seconds = 500ms } return; } // Check if second enemy was clicked and character has muscle >= 100 var enemy1Left = enemy1.x - 100; var enemy1Right = enemy1.x + 100; var enemy1Top = enemy1.y - 100; var enemy1Bottom = enemy1.y + 100; if (x >= enemy1Left && x <= enemy1Right && y >= enemy1Top && y <= enemy1Bottom && muscle >= 100) { var currentTime = Date.now(); // Check if 0.5 seconds have passed since last click if (currentTime - enemy1LastClickTime >= 500) { enemy1LastClickTime = currentTime; // Wait 0.5 seconds then increment win by 15 LK.setTimeout(function () { win = formatWin(win + 15 + totalWinBoost); storage.win = win; }, 500); // 0.5 seconds = 500ms } return; } // Check if third enemy was clicked and character has muscle >= 5000 var enemy2Left = enemy2.x - 100; var enemy2Right = enemy2.x + 100; var enemy2Top = enemy2.y - 100; var enemy2Bottom = enemy2.y + 100; if (x >= enemy2Left && x <= enemy2Right && y >= enemy2Top && y <= enemy2Bottom && muscle >= 5000) { var currentTime = Date.now(); // Check if 0.5 seconds have passed since last click if (currentTime - enemy2LastClickTime >= 500) { enemy2LastClickTime = currentTime; // Wait 0.5 seconds then increment win by 1000 LK.setTimeout(function () { win = formatWin(win + 1000 + totalWinBoost); storage.win = win; }, 500); // 0.5 seconds = 500ms } return; } // Check if fourth enemy was clicked and character has muscle >= 50000 var enemy3Left = enemy3.x - 100; var enemy3Right = enemy3.x + 100; var enemy3Top = enemy3.y - 100; var enemy3Bottom = enemy3.y + 100; if (x >= enemy3Left && x <= enemy3Right && y >= enemy3Top && y <= enemy3Bottom && muscle >= 50000) { var currentTime = Date.now(); // Check if 0.5 seconds have passed since last click if (currentTime - enemy3LastClickTime >= 500) { enemy3LastClickTime = currentTime; // Wait 0.5 seconds then increment win by 10000 LK.setTimeout(function () { win = formatWin(win + 10000 + totalWinBoost); storage.win = win; }, 500); // 0.5 seconds = 500ms } return; } // Check if weight lifting rectangle was clicked var rectLeft = weightLiftingRect.x - 175; var rectRight = weightLiftingRect.x + 175; var rectTop = weightLiftingRect.y - 70; var rectBottom = weightLiftingRect.y + 70; if (x >= rectLeft && x <= rectRight && y >= rectTop && y <= rectBottom && !isMovingToWeights && !isWaitingAtWeights) { // Move character to weight lifting area isMovingToWeights = true; character.setVelocity(0, 0); // Stop current movement tween(character, { x: weightLiftingRect.x, y: weightLiftingRect.y + 350 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { isMovingToWeights = false; isWaitingAtWeights = true; // Wait 1 second then increase muscle LK.setTimeout(function () { muscle = Math.round((muscle + 1 + muscleBoost + totalPetMuscleBoost) * 10) / 10; storage.muscle = muscle; isWaitingAtWeights = false; }, 250); } }); return; } // Check if second weight lifting rectangle was clicked and character has muscle >= 10000 var rect1Left = weightLiftingRect1.x - 175; var rect1Right = weightLiftingRect1.x + 175; var rect1Top = weightLiftingRect1.y - 70; var rect1Bottom = weightLiftingRect1.y + 70; if (x >= rect1Left && x <= rect1Right && y >= rect1Top && y <= rect1Bottom && muscle >= 10000 && !isMovingToWeights && !isWaitingAtWeights) { // Move character to second weight lifting area isMovingToWeights = true; character.setVelocity(0, 0); // Stop current movement tween(character, { x: weightLiftingRect1.x, y: weightLiftingRect1.y + 350 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { isMovingToWeights = false; isWaitingAtWeights = true; // Wait 1 second then increase muscle by 300 LK.setTimeout(function () { muscle = Math.round((muscle + 300 + muscleBoost + totalPetMuscleBoost) * 10) / 10; storage.muscle = muscle; isWaitingAtWeights = false; }, 250); } }); return; } // Check if third weight lifting rectangle was clicked and character has muscle >= 100000 var rect2Left = weightLiftingRect2.x - 175; var rect2Right = weightLiftingRect2.x + 175; var rect2Top = weightLiftingRect2.y - 70; var rect2Bottom = weightLiftingRect2.y + 70; if (x >= rect2Left && x <= rect2Right && y >= rect2Top && y <= rect2Bottom && muscle >= 100000 && !isMovingToWeights && !isWaitingAtWeights) { // Move character to third weight lifting area isMovingToWeights = true; character.setVelocity(0, 0); // Stop current movement tween(character, { x: weightLiftingRect2.x, y: weightLiftingRect2.y + 350 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { isMovingToWeights = false; isWaitingAtWeights = true; // Wait 1 second then increase muscle by 2000 LK.setTimeout(function () { muscle = Math.round((muscle + 2000 + muscleBoost + totalPetMuscleBoost) * 10) / 10; storage.muscle = muscle; isWaitingAtWeights = false; }, 250); } }); return; } // Show joystick in expanded area (left side to middle, expanded Y area) if (x > 0 && x < 1200 && y > 2082) { joystick.show(x, y); isDragging = true; var input = joystick.updateHandle(x, y); if (input) { character.setVelocity(input.x * input.magnitude, input.y * input.magnitude); } } }; game.move = function (x, y, obj) { if (isDragging && joystick.isActive && !isMovingToWeights && !isWaitingAtWeights) { var input = joystick.updateHandle(x, y); if (input) { character.setVelocity(input.x * input.magnitude, input.y * input.magnitude); } } }; game.up = function (x, y, obj) { if (isDragging && !isMovingToWeights && !isWaitingAtWeights) { isDragging = false; joystick.hide(); character.setVelocity(0, 0); } }; game.update = function () { // Character update is handled automatically by its update method };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Character = Container.expand(function () {
var self = Container.call(this);
var characterGraphics = self.attachAsset('character', {
anchorX: 0.5,
anchorY: 0.5
});
// Add floating text for muscle display
self.muscleText = new Text2('Muscle: 0', {
size: 60,
fill: '#ffffff'
});
self.muscleText.anchor.set(0.5, 1);
self.addChild(self.muscleText);
self.speed = 8;
self.velocityX = 0;
self.velocityY = 0;
self.targetRotation = 0;
self.setVelocity = function (vx, vy) {
self.velocityX = vx;
self.velocityY = vy;
// Calculate rotation to face movement direction
if (vx !== 0 || vy !== 0) {
self.targetRotation = Math.atan2(vy, vx);
}
};
self.update = function () {
// Store previous position for collision detection
var prevX = self.x;
var prevY = self.y;
// Move character
self.x += self.velocityX * self.speed;
self.y += self.velocityY * self.speed;
// Check collision with enemy (barrier)
var enemyLeft = enemy.x - 100 - 115; // enemy half width + character half width
var enemyRight = enemy.x + 100 + 115;
var enemyTop = enemy.y - 100 - 115;
var enemyBottom = enemy.y + 100 + 115;
if (self.x >= enemyLeft && self.x <= enemyRight && self.y >= enemyTop && self.y <= enemyBottom) {
// Collision detected, revert to previous position
self.x = prevX;
self.y = prevY;
self.setVelocity(0, 0);
}
// Check collision with weight lifting area (barrier)
var weightLeft = weightLiftingRect.x - 175 - 115; // weight half width + character half width
var weightRight = weightLiftingRect.x + 175 + 115;
var weightTop = weightLiftingRect.y - 203 - 115; // weight half height + character half width
var weightBottom = weightLiftingRect.y + 203 + 115;
if (self.x >= weightLeft && self.x <= weightRight && self.y >= weightTop && self.y <= weightBottom) {
// Collision detected, revert to previous position
self.x = prevX;
self.y = prevY;
self.setVelocity(0, 0);
}
// Check collision with second weight lifting area (barrier)
var weight1Left = weightLiftingRect1.x - 175 - 115; // weight half width + character half width
var weight1Right = weightLiftingRect1.x + 175 + 115;
var weight1Top = weightLiftingRect1.y - 203 - 115; // weight half height + character half width
var weight1Bottom = weightLiftingRect1.y + 203 + 115;
if (self.x >= weight1Left && self.x <= weight1Right && self.y >= weight1Top && self.y <= weight1Bottom) {
// Collision detected, revert to previous position
self.x = prevX;
self.y = prevY;
self.setVelocity(0, 0);
}
// Check collision with third enemy (barrier)
var enemy2Left = enemy2.x - 100 - 115; // enemy half width + character half width
var enemy2Right = enemy2.x + 100 + 115;
var enemy2Top = enemy2.y - 100 - 115;
var enemy2Bottom = enemy2.y + 100 + 115;
if (self.x >= enemy2Left && self.x <= enemy2Right && self.y >= enemy2Top && self.y <= enemy2Bottom) {
// Collision detected, revert to previous position
self.x = prevX;
self.y = prevY;
self.setVelocity(0, 0);
}
// Check collision with fourth enemy (barrier)
var enemy3Left = enemy3.x - 100 - 115; // enemy half width + character half width
var enemy3Right = enemy3.x + 100 + 115;
var enemy3Top = enemy3.y - 100 - 115;
var enemy3Bottom = enemy3.y + 100 + 115;
if (self.x >= enemy3Left && self.x <= enemy3Right && self.y >= enemy3Top && self.y <= enemy3Bottom) {
// Collision detected, revert to previous position
self.x = prevX;
self.y = prevY;
self.setVelocity(0, 0);
}
// Check collision with third weight lifting area (barrier)
var weight2Left = weightLiftingRect2.x - 175 - 115; // weight half width + character half width
var weight2Right = weightLiftingRect2.x + 175 + 115;
var weight2Top = weightLiftingRect2.y - 203 - 115; // weight half height + character half width
var weight2Bottom = weightLiftingRect2.y + 203 + 115;
if (self.x >= weight2Left && self.x <= weight2Right && self.y >= weight2Top && self.y <= weight2Bottom) {
// Collision detected, revert to previous position
self.x = prevX;
self.y = prevY;
self.setVelocity(0, 0);
}
// Keep character within screen bounds only
if (self.x < 40) {
self.x = 40;
}
if (self.x > 2008) {
self.x = 2008;
}
if (self.y < 40) {
self.y = 40;
}
if (self.y > 2692) {
self.y = 2692;
}
// Update character graphics based on muscle level
var currentAssetId = 'character';
if (muscle >= 100000000) {
currentAssetId = 'character_100m';
} else if (muscle >= 10000000) {
currentAssetId = 'character_10m';
} else if (muscle >= 1000000) {
currentAssetId = 'character_1m';
} else if (muscle >= 100000) {
currentAssetId = 'character_100k';
} else if (muscle >= 10000) {
currentAssetId = 'character_10k';
} else if (muscle >= 1000) {
currentAssetId = 'character_1k';
}
// Check if we need to change the character asset
if (!self.currentAssetId || self.currentAssetId !== currentAssetId) {
// Remove old graphics
if (characterGraphics.parent) {
self.removeChild(characterGraphics);
}
// Add new graphics
characterGraphics = self.attachAsset(currentAssetId, {
anchorX: 0.5,
anchorY: 0.5
});
self.currentAssetId = currentAssetId;
}
// Update muscle text with formatted display
self.muscleText.setText('Muscle: ' + formatMuscle(muscle));
self.muscleText.x = 0;
self.muscleText.y = -100; // 50px higher than before
// Update win text
if (!self.winText) {
self.winText = new Text2('Win: 0', {
size: 60,
fill: '#ffffff'
});
self.winText.anchor.set(0.5, 1);
self.addChild(self.winText);
}
self.winText.setText('Win: ' + formatWin(win));
self.winText.x = 0;
self.winText.y = -150; // 50px above muscle text
// Smooth rotation towards target
var currentRotation = characterGraphics.rotation;
var rotationDiff = self.targetRotation - currentRotation;
// Handle rotation wrapping
if (rotationDiff > Math.PI) {
rotationDiff -= 2 * Math.PI;
}
if (rotationDiff < -Math.PI) {
rotationDiff += 2 * Math.PI;
}
characterGraphics.rotation += rotationDiff * 0.15;
};
return self;
});
var Joystick = Container.expand(function () {
var self = Container.call(this);
var baseGraphics = self.attachAsset('joystickBase', {
anchorX: 0.5,
anchorY: 0.5
});
var handleGraphics = self.attachAsset('joystickHandle', {
anchorX: 0.5,
anchorY: 0.5
});
baseGraphics.alpha = 0.3;
handleGraphics.alpha = 0.7;
self.baseRadius = 100;
self.handleRadius = 40;
self.isActive = false;
self.centerX = 0;
self.centerY = 0;
self.handleX = 0;
self.handleY = 0;
self.show = function (x, y) {
self.visible = true;
self.isActive = true;
self.x = x;
self.y = y;
self.centerX = x;
self.centerY = y;
self.handleX = 0;
self.handleY = 0;
handleGraphics.x = 0;
handleGraphics.y = 0;
};
self.hide = function () {
self.visible = false;
self.isActive = false;
// Smooth return to center
tween(handleGraphics, {
x: 0,
y: 0
}, {
duration: 200
});
};
self.updateHandle = function (x, y) {
if (!self.isActive) {
return;
}
// Calculate offset from center
var offsetX = x - self.centerX;
var offsetY = y - self.centerY;
var distance = Math.sqrt(offsetX * offsetX + offsetY * offsetY);
// Constrain handle within base radius
if (distance > self.baseRadius) {
offsetX = offsetX / distance * self.baseRadius;
offsetY = offsetY / distance * self.baseRadius;
distance = self.baseRadius;
}
self.handleX = offsetX;
self.handleY = offsetY;
handleGraphics.x = offsetX;
handleGraphics.y = offsetY;
// Return normalized values for movement
return {
x: offsetX / self.baseRadius,
y: offsetY / self.baseRadius,
magnitude: distance / self.baseRadius
};
};
self.visible = false;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2C3E50
});
/****
* Game Code
****/
// Initialize muscle variable
var muscle = storage.muscle || 0;
// Initialize win variable
var win = storage.win || 0;
// Function to format win numbers with proper decimal places
function formatWin(value) {
if (value >= 1) {
// For values >= 1, use maximum 2 decimal places
return Math.round(value * 100) / 100;
} else {
// For values < 1, round to 2 decimal places and format appropriately
var rounded = Math.round(value * 100) / 100;
return rounded;
}
}
// Function to format muscle numbers with k, m, b, t notation
function formatMuscle(value) {
if (value >= 1000000000000) {
// For trillions
var trillions = value / 1000000000000;
if (trillions >= 10) {
return Math.floor(trillions) + 't';
} else {
return Math.floor(trillions * 10) / 10 + 't';
}
} else if (value >= 1000000000) {
// For billions
var billions = value / 1000000000;
if (billions >= 10) {
return Math.floor(billions) + 'b';
} else {
return Math.floor(billions * 10) / 10 + 'b';
}
} else if (value >= 1000000) {
// For millions
var millions = value / 1000000;
if (millions >= 10) {
return Math.floor(millions) + 'm';
} else {
return Math.floor(millions * 10) / 10 + 'm';
}
} else if (value >= 1000) {
// For thousands
var thousands = value / 1000;
if (thousands >= 10) {
return Math.floor(thousands) + 'k';
} else {
return Math.floor(thousands * 10) / 10 + 'k';
}
} else {
// For values less than 1000, show with max 2 decimal places
return Math.round(value * 100) / 100;
}
}
// Universal function to format all numbers with k, m, b, t notation for display
function formatNumber(value) {
if (value >= 1000000000000) {
// For trillions
var trillions = value / 1000000000000;
if (trillions >= 10) {
return Math.floor(trillions) + 't';
} else {
return Math.floor(trillions * 10) / 10 + 't';
}
} else if (value >= 1000000000) {
// For billions
var billions = value / 1000000000;
if (billions >= 10) {
return Math.floor(billions) + 'b';
} else {
return Math.floor(billions * 10) / 10 + 'b';
}
} else if (value >= 1000000) {
// For millions
var millions = value / 1000000;
if (millions >= 10) {
return Math.floor(millions) + 'm';
} else {
return Math.floor(millions * 10) / 10 + 'm';
}
} else if (value >= 1000) {
// For thousands
var thousands = value / 1000;
if (thousands >= 10) {
return Math.floor(thousands) + 'k';
} else {
return Math.floor(thousands * 10) / 10 + 'k';
}
} else {
// For values < 1000, show with proper decimal places
return Math.round(value * 100) / 100;
}
}
// Initialize pet inventory
var petCount = storage.petCount || 0;
var pet1Count = storage.pet1Count || 0;
var pet2Count = storage.pet2Count || 0;
var pet3Count = storage.pet3Count || 0;
var pet4Count = storage.pet4Count || 0;
var pet5Count = storage.pet5Count || 0;
var pet6Count = storage.pet6Count || 0;
var pet7Count = storage.pet7Count || 0;
var pet8Count = storage.pet8Count || 0;
var pet9Count = storage.pet9Count || 0;
var petSecretCount = storage.petSecretCount || 0;
var richWaterMelonCount = storage.richWaterMelonCount || 0;
// Initialize pet boost values
var petWinBoost = petCount * 0.02; // 0.02 per pet
var pet1WinBoost = pet1Count * 0.06; // 0.06 per pet1
var pet2WinBoost = pet2Count * 0.2; // 0.2 per pet2
var pet3WinBoost = pet3Count * 1.5; // 1.5 per pet3
var pet4WinBoost = pet4Count * 60; // 60 per pet4
var pet5WinBoost = pet5Count * 0.1; // 0.1 per pet5
var pet6WinBoost = pet6Count * 0.4; // 0.4 per pet6
var pet7WinBoost = pet7Count * 2; // 2 per pet7
var pet8WinBoost = pet8Count * 15; // 15 per pet8
var pet9WinBoost = pet9Count * 100; // 100 per pet9
var petSecretWinBoost = petSecretCount > 0 ? (petWinBoost + pet1WinBoost + pet2WinBoost + pet3WinBoost + pet4WinBoost + pet5WinBoost + pet6WinBoost + pet7WinBoost + pet8WinBoost + pet9WinBoost) * 5 : 0;
var totalWinBoost = petWinBoost + pet1WinBoost + pet2WinBoost + pet3WinBoost + pet4WinBoost + pet5WinBoost + pet6WinBoost + pet7WinBoost + pet8WinBoost + pet9WinBoost + petSecretWinBoost;
// Initialize pet muscle boost values
var petMuscleBoost = petCount * 0.01; // 0.01 per pet
var pet1MuscleBoost = pet1Count * 0.03; // 0.03 per pet1
var pet2MuscleBoost = pet2Count * 0.1; // 0.1 per pet2
var pet3MuscleBoost = pet3Count * 0.75; // 0.75 per pet3
var pet4MuscleBoost = pet4Count * 30; // 30 per pet4
var pet5MuscleBoost = pet5Count * 0.07; // 0.07 per pet5
var pet6MuscleBoost = pet6Count * 0.2; // 0.2 per pet6
var pet7MuscleBoost = pet7Count * 1.2; // 1.2 per pet7
var pet8MuscleBoost = pet8Count * 10; // 10 per pet8
var pet9MuscleBoost = pet9Count * 85; // 85 per pet9
var petSecretMuscleBoost = petSecretCount > 0 ? (petMuscleBoost + pet1MuscleBoost + pet2MuscleBoost + pet3MuscleBoost + pet4MuscleBoost + pet5MuscleBoost + pet6MuscleBoost + pet7MuscleBoost + pet8MuscleBoost + pet9MuscleBoost) * 5 : 0;
var totalPetMuscleBoost = petMuscleBoost + pet1MuscleBoost + pet2MuscleBoost + pet3MuscleBoost + pet4MuscleBoost + pet5MuscleBoost + pet6MuscleBoost + pet7MuscleBoost + pet8MuscleBoost + pet9MuscleBoost + petSecretMuscleBoost;
// Initialize shop variables
var muscleBoost = storage.muscleBoost || 0; // Additional muscle gain per flex
var shopPrice = storage.shopPrice || 10; // Current price for muscle boost
var shopBoostAmount = 1.5; // Current boost amount
var luckBoost = storage.luckBoost || 0; // Luck boost count
var luckPrice = storage.luckPrice || 100; // Current price for luck boost
var isShopOpen = false; // Track if shop UI is open
var isInventoryOpen = false; // Track if inventory UI is open
var isAdminOpen = false; // Track if admin panel is open
var adminCode = '616172'; // Secret admin code
var currentInventoryPage = 1; // Current page in inventory (1 or 2)
var maxInventoryPages = 2; // Total pages available
// Joystick handle (smaller circle)
// Joystick base (semi-transparent circle)
// Character shape
var character = game.addChild(new Character());
character.x = 1024;
character.y = 1366;
// Create Weight Lifting rectangle at top-center, 100px from left edge
var weightLiftingRect = game.addChild(LK.getAsset('weightLiftingRect', {
anchorX: 0.5,
anchorY: 0.5
}));
weightLiftingRect.x = 200 + 175; // 200px from left + half width (175) to center
weightLiftingRect.y = 50 + 110; // 50 + half height (70) to center
// Add text above the rectangle
var weightLiftingText = new Text2('Weight Lifting', {
size: 58,
// 36 * 1.6 = 57.6, rounded to 58
fill: '#ffffff'
});
weightLiftingText.anchor.set(0.5, 1);
weightLiftingText.x = weightLiftingRect.x;
weightLiftingText.y = weightLiftingRect.y - 75;
game.addChild(weightLiftingText);
// Add text below the first weight lifting rectangle showing "0 muscle"
var weightLiftingMuscleText = new Text2('0 muscle', {
size: 48,
fill: '#ffffff'
});
weightLiftingMuscleText.anchor.set(0.5, 0);
weightLiftingMuscleText.x = weightLiftingRect.x;
weightLiftingMuscleText.y = weightLiftingRect.y + 75;
game.addChild(weightLiftingMuscleText);
// Add "1 muscle" text below the first weight lifting muscle text
var weightLiftingMuscleText_1 = new Text2('1 muscle', {
size: 48,
fill: '#ffffff'
});
weightLiftingMuscleText_1.anchor.set(0.5, 0);
weightLiftingMuscleText_1.x = weightLiftingRect.x;
weightLiftingMuscleText_1.y = weightLiftingMuscleText.y + 40;
game.addChild(weightLiftingMuscleText_1);
// Create second Weight Lifting rectangle 500px to the right of the first one
var weightLiftingRect1 = game.addChild(LK.getAsset('weightLiftingRect1', {
anchorX: 0.5,
anchorY: 0.5
}));
weightLiftingRect1.x = weightLiftingRect.x + 500; // 500px to the right
weightLiftingRect1.y = weightLiftingRect.y; // Same Y position
// Add text above the second rectangle
var weightLiftingText1 = new Text2('Weight Lifting', {
size: 58,
fill: '#ffffff'
});
weightLiftingText1.anchor.set(0.5, 1);
weightLiftingText1.x = weightLiftingRect1.x;
weightLiftingText1.y = weightLiftingRect1.y - 75;
game.addChild(weightLiftingText1);
// Add text below the second weight lifting rectangle showing "10k muscle"
var weightLiftingMuscleText1 = new Text2('10k muscle', {
size: 48,
fill: '#ffffff'
});
weightLiftingMuscleText1.anchor.set(0.5, 0);
weightLiftingMuscleText1.x = weightLiftingRect1.x;
weightLiftingMuscleText1.y = weightLiftingRect1.y + 75;
game.addChild(weightLiftingMuscleText1);
// Add "300 muscle" text below the second weight lifting muscle text
var weightLiftingMuscleText1_5 = new Text2('300 muscle', {
size: 48,
fill: '#ffffff'
});
weightLiftingMuscleText1_5.anchor.set(0.5, 0);
weightLiftingMuscleText1_5.x = weightLiftingRect1.x;
weightLiftingMuscleText1_5.y = weightLiftingMuscleText1.y + 40;
game.addChild(weightLiftingMuscleText1_5);
// Create third Weight Lifting rectangle to the right of the second one
var weightLiftingRect2 = game.addChild(LK.getAsset('weightLiftingRect2', {
anchorX: 0.5,
anchorY: 0.5
}));
weightLiftingRect2.x = weightLiftingRect1.x + 500; // 500px to the right of second one
weightLiftingRect2.y = weightLiftingRect1.y; // Same Y position
// Add text above the third rectangle
var weightLiftingText2 = new Text2('Weight Lifting', {
size: 58,
fill: '#ffffff'
});
weightLiftingText2.anchor.set(0.5, 1);
weightLiftingText2.x = weightLiftingRect2.x;
weightLiftingText2.y = weightLiftingRect2.y - 75;
game.addChild(weightLiftingText2);
// Add text below the third weight lifting rectangle showing "100k muscle"
var weightLiftingMuscleText2 = new Text2('100k muscle', {
size: 48,
fill: '#ffffff'
});
weightLiftingMuscleText2.anchor.set(0.5, 0);
weightLiftingMuscleText2.x = weightLiftingRect2.x;
weightLiftingMuscleText2.y = weightLiftingRect2.y + 75;
game.addChild(weightLiftingMuscleText2);
// Add "2k muscle" text below the third weight lifting muscle text
var weightLiftingMuscleText2_2k = new Text2('2k muscle', {
size: 48,
fill: '#ffffff'
});
weightLiftingMuscleText2_2k.anchor.set(0.5, 0);
weightLiftingMuscleText2_2k.x = weightLiftingRect2.x;
weightLiftingMuscleText2_2k.y = weightLiftingMuscleText2.y + 40;
game.addChild(weightLiftingMuscleText2_2k);
// Create enemy at top right, 150px from top
var enemy = game.addChild(LK.getAsset('dusman', {
anchorX: 0.5,
anchorY: 0.5
}));
enemy.x = 2048 - 200; // Right edge minus half width
enemy.y = 150 + 100; // 150px from top plus half height
// Add power text above enemy
var enemyPowerText = new Text2('Power: ' + formatNumber(10), {
size: 60,
fill: '#ffffff'
});
enemyPowerText.anchor.set(0.5, 1);
enemyPowerText.x = enemy.x;
enemyPowerText.y = enemy.y - 100;
game.addChild(enemyPowerText);
// Add "1 win" text below first enemy
var enemyWinText = new Text2('1 win', {
size: 60,
fill: '#ffffff'
});
enemyWinText.anchor.set(0.5, 0);
enemyWinText.x = enemy.x;
enemyWinText.y = enemy.y + 100;
game.addChild(enemyWinText);
// Create second enemy 300px below the first one
var enemy1 = game.addChild(LK.getAsset('dusman1', {
anchorX: 0.5,
anchorY: 0.5
}));
enemy1.x = enemy.x; // Same X position as first enemy
enemy1.y = enemy.y + 350; // 350px below first enemy
// Add power text above second enemy
var enemy1PowerText = new Text2('Power: ' + formatNumber(100), {
size: 60,
fill: '#ffffff'
});
enemy1PowerText.anchor.set(0.5, 1);
enemy1PowerText.x = enemy1.x;
enemy1PowerText.y = enemy1.y - 100;
game.addChild(enemy1PowerText);
// Add "15 win" text below second enemy
var enemy1WinText = new Text2('15 win', {
size: 60,
fill: '#ffffff'
});
enemy1WinText.anchor.set(0.5, 0);
enemy1WinText.x = enemy1.x;
enemy1WinText.y = enemy1.y + 100;
game.addChild(enemy1WinText);
// Create third enemy 350px below the second one
var enemy2 = game.addChild(LK.getAsset('dusman2', {
anchorX: 0.5,
anchorY: 0.5
}));
enemy2.x = enemy1.x; // Same X position as previous enemies
enemy2.y = enemy1.y + 350; // 350px below second enemy
// Add power text above third enemy
var enemy2PowerText = new Text2('Power: ' + formatNumber(5000), {
size: 60,
fill: '#ffffff'
});
enemy2PowerText.anchor.set(0.5, 1);
enemy2PowerText.x = enemy2.x;
enemy2PowerText.y = enemy2.y - 100;
game.addChild(enemy2PowerText);
// Add "1k win" text below third enemy
var enemy2WinText = new Text2('1k win', {
size: 60,
fill: '#ffffff'
});
enemy2WinText.anchor.set(0.5, 0);
enemy2WinText.x = enemy2.x;
enemy2WinText.y = enemy2.y + 100;
game.addChild(enemy2WinText);
// Create fourth enemy 350px below the third one
var enemy3 = game.addChild(LK.getAsset('dusman3', {
anchorX: 0.5,
anchorY: 0.5
}));
enemy3.x = enemy2.x; // Same X position as previous enemies
enemy3.y = enemy2.y + 350; // 350px below third enemy
// Add power text above fourth enemy
var enemy3PowerText = new Text2('Power: ' + formatNumber(50000), {
size: 60,
fill: '#ffffff'
});
enemy3PowerText.anchor.set(0.5, 1);
enemy3PowerText.x = enemy3.x;
enemy3PowerText.y = enemy3.y - 100;
game.addChild(enemy3PowerText);
// Add "10k win" text below fourth enemy
var enemy3WinText = new Text2('10k win', {
size: 60,
fill: '#ffffff'
});
enemy3WinText.anchor.set(0.5, 0);
enemy3WinText.x = enemy3.x;
enemy3WinText.y = enemy3.y + 100;
game.addChild(enemy3WinText);
// Variables for weight lifting interaction
var isMovingToWeights = false;
var isWaitingAtWeights = false;
var joystick = game.addChild(new Joystick());
var isDragging = false;
var joystickTouchId = null;
// Create egg object at left center, 200px up from center
var egg = game.addChild(LK.getAsset('egg', {
anchorX: 0.5,
anchorY: 0.5
}));
egg.x = 100; // Left edge + some margin
egg.y = 866 - 200; // Center Y - 200px
// Add "Egg 1" text above egg
var eggTitle = new Text2('Egg 1', {
size: 60,
fill: '#ffffff'
});
eggTitle.anchor.set(0.5, 1);
eggTitle.x = egg.x;
eggTitle.y = egg.y - 160; // Above egg
game.addChild(eggTitle);
// Add "200 wins" text below egg title
var eggCost = new Text2(formatNumber(200) + ' wins', {
size: 50,
fill: '#ffffff'
});
eggCost.anchor.set(0.5, 1);
eggCost.x = egg.x;
eggCost.y = egg.y - 100; // Below egg title, above egg
game.addChild(eggCost);
// Create second egg object 400px below the first egg
var egg2 = game.addChild(LK.getAsset('egg2', {
anchorX: 0.5,
anchorY: 0.5
}));
egg2.x = egg.x; // Same X position as first egg
egg2.y = egg.y + 400; // 400px below first egg (250 + 150)
// Add "Egg 2" text above second egg
var egg2Title = new Text2('Egg 2', {
size: 60,
fill: '#ffffff'
});
egg2Title.anchor.set(0.5, 1);
egg2Title.x = egg2.x;
egg2Title.y = egg2.y - 160; // Above egg2
game.addChild(egg2Title);
// Add "5k wins" text below egg2 title
var egg2Cost = new Text2(formatNumber(5000) + ' wins', {
size: 50,
fill: '#ffffff'
});
egg2Cost.anchor.set(0.5, 1);
egg2Cost.x = egg2.x;
egg2Cost.y = egg2.y - 100; // Below egg2 title, above egg2
game.addChild(egg2Cost);
// Create admin panel button above inventory
var adminPanel = LK.gui.bottomRight.addChild(LK.getAsset('admin_panel', {
anchorX: 1,
anchorY: 1,
scaleX: 1,
scaleY: 1
}));
adminPanel.x = -50;
adminPanel.y = -510; // 250px above inventory (260 + 250)
// Add admin panel text
var adminPanelText = new Text2('Admin Panel', {
size: 25,
fill: '#ffffff'
});
adminPanelText.anchor.set(0.5, 0.5);
adminPanelText.x = adminPanel.width / 2;
adminPanelText.y = adminPanel.height / 2;
adminPanel.addChild(adminPanelText);
// Create inventory button above shop
var inventory = LK.gui.bottomRight.addChild(LK.getAsset('inventory', {
anchorX: 1,
anchorY: 1,
scaleX: 0.15,
scaleY: 0.15
}));
inventory.x = -50;
inventory.y = -260; // 150px above shop (-50 - 150 = -200)
// Add inventory text
var inventoryText = new Text2('Inventory', {
size: 35,
fill: '#ffffff'
});
inventoryText.anchor.set(0.5, 0.5);
inventoryText.x = inventory.width / 2;
inventoryText.y = inventory.height / 2;
inventory.addChild(inventoryText);
// Create shop object at bottom right
var shop = LK.gui.bottomRight.addChild(LK.getAsset('shop_bg', {
anchorX: 1,
anchorY: 1,
scaleX: 0.15,
scaleY: 0.15
}));
shop.x = -50;
shop.y = -50;
// Add shop text
var shopText = new Text2('Shop', {
size: 40,
fill: '#ffffff'
});
shopText.anchor.set(0.5, 0.5);
shopText.x = shop.width / 2;
shopText.y = shop.height / 2;
shop.addChild(shopText);
// Create shop UI (initially hidden)
var shopUI = LK.gui.center.addChild(LK.getAsset('shop_bg', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.65,
scaleY: 0.65
}));
shopUI.visible = false;
// Create inventory UI (initially hidden)
var inventoryUI = LK.gui.center.addChild(LK.getAsset('inventory', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.65,
scaleY: 0.65
}));
inventoryUI.visible = false;
// Create admin panel UI (initially hidden)
var adminPanelUI = LK.gui.center.addChild(LK.getAsset('in_admin_panel', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1,
scaleY: 1
}));
adminPanelUI.visible = false;
// Create admin panel close button
var adminCloseButton = LK.gui.center.addChild(LK.getAsset('close', {
anchorX: 0.5,
anchorY: 0.5
}));
adminCloseButton.visible = false;
adminCloseButton.x = 350;
adminCloseButton.y = -250;
// Create admin panel input prompt
var adminCodePrompt = LK.gui.center.addChild(new Text2('Enter Code:', {
size: 60,
fill: '#ffffff'
}));
adminCodePrompt.anchor.set(0.5, 0.5);
adminCodePrompt.visible = false;
adminCodePrompt.x = 0;
adminCodePrompt.y = -300;
// Create number input buttons (0-9) in phone keypad layout
var numberButtons = [];
var numberButtonTexts = [];
for (var i = 0; i <= 9; i++) {
var buttonX, buttonY;
if (i === 0) {
// 0 button at bottom center
buttonX = 0;
buttonY = 200;
} else if (i >= 1 && i <= 3) {
// 1, 2, 3 at top row
buttonX = (i - 2) * 100;
buttonY = -50;
} else if (i >= 4 && i <= 6) {
// 4, 5, 6 at middle row
buttonX = (i - 5) * 100;
buttonY = 50;
} else if (i >= 7 && i <= 9) {
// 7, 8, 9 at bottom row
buttonX = (i - 8) * 100;
buttonY = 150;
}
var button = LK.gui.center.addChild(LK.getAsset('admin_number_btn', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1,
scaleY: 1
}));
button.x = buttonX;
button.y = buttonY;
button.visible = false;
var buttonText = new Text2(i.toString(), {
size: 80,
fill: '#ffffff'
});
buttonText.anchor.set(0.5, 0.5);
button.addChild(buttonText);
numberButtons.push(button);
numberButtonTexts.push(buttonText);
}
// Create admin panel controls text
var adminMuscleText = LK.gui.center.addChild(new Text2('Muscle', {
size: 60,
fill: '#ffffff'
}));
adminMuscleText.anchor.set(0.5, 0.5);
adminMuscleText.visible = false;
adminMuscleText.x = 0;
adminMuscleText.y = -150;
var adminWinText = LK.gui.center.addChild(new Text2('Win', {
size: 60,
fill: '#ffffff'
}));
adminWinText.anchor.set(0.5, 0.5);
adminWinText.visible = false;
adminWinText.x = 0;
adminWinText.y = -50;
var adminLuckText = LK.gui.center.addChild(new Text2('Luck Boost', {
size: 60,
fill: '#ffffff'
}));
adminLuckText.anchor.set(0.5, 0.5);
adminLuckText.visible = false;
adminLuckText.x = 0;
adminLuckText.y = 50;
var adminEnterButton = LK.gui.center.addChild(LK.getAsset('admin_number_btn', {
anchorX: 0.5,
anchorY: 0.5
}));
adminEnterButton.visible = false;
adminEnterButton.x = 0;
adminEnterButton.y = 150;
var adminEnterText = new Text2('Enter', {
size: 40,
fill: '#ffffff'
});
adminEnterText.anchor.set(0.5, 0.5);
adminEnterButton.addChild(adminEnterText);
var adminDeleteButton = LK.gui.center.addChild(LK.getAsset('admin_number_btn', {
anchorX: 0.5,
anchorY: 0.5
}));
adminDeleteButton.visible = false;
adminDeleteButton.x = 100;
adminDeleteButton.y = 150;
var adminDeleteText = new Text2('Delete', {
size: 35,
fill: '#ff0000'
});
adminDeleteText.anchor.set(0.5, 0.5);
adminDeleteButton.addChild(adminDeleteText);
// Variables for admin input
var currentInputCode = '';
var isCodePromptActive = false;
var isAdminInputMode = false;
var adminInputType = '';
var adminCurrentValue = '';
// Create in_inventory image UI element (initially hidden)
var inInventoryImage = LK.gui.center.addChild(LK.getAsset('in_inventory', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
}));
inInventoryImage.visible = false;
// Create pet display elements (initially hidden)
var petDisplay = LK.gui.center.addChild(LK.getAsset('pet', {
anchorX: 0.5,
anchorY: 0.5
}));
petDisplay.visible = false;
petDisplay.x = -280;
petDisplay.y = -140;
var pet1Display = LK.gui.center.addChild(LK.getAsset('pet1', {
anchorX: 0.5,
anchorY: 0.5
}));
pet1Display.visible = false;
pet1Display.x = -40;
pet1Display.y = -140;
var pet2Display = LK.gui.center.addChild(LK.getAsset('pet2', {
anchorX: 0.5,
anchorY: 0.5
}));
pet2Display.visible = false;
pet2Display.x = 200;
pet2Display.y = -140;
var pet3Display = LK.gui.center.addChild(LK.getAsset('pet3', {
anchorX: 0.5,
anchorY: 0.5
}));
pet3Display.visible = false;
pet3Display.x = -280;
pet3Display.y = 160;
var pet4Display = LK.gui.center.addChild(LK.getAsset('pet4', {
anchorX: 0.5,
anchorY: 0.5
}));
pet4Display.visible = false;
pet4Display.x = -40;
pet4Display.y = 160;
// Create count text for pets
var petCountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
petCountText.anchor.set(0, 1);
petCountText.visible = false;
petCountText.x = -265 - 50; // Bottom left of pet display
petCountText.y = -105;
var pet1CountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
pet1CountText.anchor.set(0, 1);
pet1CountText.visible = false;
pet1CountText.x = -25 - 50; // Bottom left of pet1 display
pet1CountText.y = -105;
var pet2CountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
pet2CountText.anchor.set(0, 1);
pet2CountText.visible = false;
pet2CountText.x = 215 - 50; // Bottom left of pet2 display
pet2CountText.y = -105;
var pet3CountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
pet3CountText.anchor.set(0, 1);
pet3CountText.visible = false;
pet3CountText.x = -265 - 50; // Bottom left of pet3 display
pet3CountText.y = 195;
var pet4CountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
pet4CountText.anchor.set(0, 1);
pet4CountText.visible = false;
pet4CountText.x = -25 - 50; // Bottom left of pet4 display
pet4CountText.y = 195;
// Add pet chance and boost text
var petChanceText = LK.gui.center.addChild(new Text2('70%', {
size: 35,
fill: '#ffffff'
}));
petChanceText.anchor.set(0.5, 0);
petChanceText.visible = false;
petChanceText.x = -280;
petChanceText.y = -70; // Below pet display
var petBoostText = LK.gui.center.addChild(new Text2('Win boost = 0.02', {
size: 27,
fill: '#ffffff'
}));
petBoostText.anchor.set(0.5, 0);
petBoostText.visible = false;
petBoostText.x = -280;
petBoostText.y = -35; // Below chance text
// Add pet1 chance and boost text
var pet1ChanceText = LK.gui.center.addChild(new Text2('30%', {
size: 35,
fill: '#ffffff'
}));
pet1ChanceText.anchor.set(0.5, 0);
pet1ChanceText.visible = false;
pet1ChanceText.x = -40;
pet1ChanceText.y = -70; // Below pet1 display
var pet1BoostText = LK.gui.center.addChild(new Text2('Win boost = 0.06', {
size: 27,
fill: '#ffffff'
}));
pet1BoostText.anchor.set(0.5, 0);
pet1BoostText.visible = false;
pet1BoostText.x = -40;
pet1BoostText.y = -35; // Below chance text
// Add pet muscle boost text
var petMuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.01', {
size: 23,
fill: '#ffffff'
}));
petMuscleBoostText.anchor.set(0.5, 0);
petMuscleBoostText.visible = false;
petMuscleBoostText.x = -280;
petMuscleBoostText.y = 0; // Below win boost text
// Add pet1 muscle boost text
var pet1MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.03', {
size: 23,
fill: '#ffffff'
}));
pet1MuscleBoostText.anchor.set(0.5, 0);
pet1MuscleBoostText.visible = false;
pet1MuscleBoostText.x = -40;
pet1MuscleBoostText.y = 0; // Below win boost text
// Add pet2 chance and boost text
var pet2ChanceText = LK.gui.center.addChild(new Text2('10%', {
size: 35,
fill: '#ffffff'
}));
pet2ChanceText.anchor.set(0.5, 0);
pet2ChanceText.visible = false;
pet2ChanceText.x = 200;
pet2ChanceText.y = -70; // Below pet2 display
var pet2BoostText = LK.gui.center.addChild(new Text2('Win boost = 0.2', {
size: 27,
fill: '#ffffff'
}));
pet2BoostText.anchor.set(0.5, 0);
pet2BoostText.visible = false;
pet2BoostText.x = 200;
pet2BoostText.y = -35; // Below chance text
var pet2MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.1', {
size: 23,
fill: '#ffffff'
}));
pet2MuscleBoostText.anchor.set(0.5, 0);
pet2MuscleBoostText.visible = false;
pet2MuscleBoostText.x = 200;
pet2MuscleBoostText.y = 0; // Below win boost text
// Add pet3 chance and boost text
var pet3ChanceText = LK.gui.center.addChild(new Text2('1%', {
size: 35,
fill: '#ffffff'
}));
pet3ChanceText.anchor.set(0.5, 0);
pet3ChanceText.visible = false;
pet3ChanceText.x = -280;
pet3ChanceText.y = 230; // Below pet3 display
var pet3BoostText = LK.gui.center.addChild(new Text2('Win boost = 1.5', {
size: 27,
fill: '#ffffff'
}));
pet3BoostText.anchor.set(0.5, 0);
pet3BoostText.visible = false;
pet3BoostText.x = -280;
pet3BoostText.y = 265; // Below chance text
var pet3MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.75', {
size: 23,
fill: '#ffffff'
}));
pet3MuscleBoostText.anchor.set(0.5, 0);
pet3MuscleBoostText.visible = false;
pet3MuscleBoostText.x = -280;
pet3MuscleBoostText.y = 300; // Below win boost text
// Add pet4 chance and boost text
var pet4ChanceText = LK.gui.center.addChild(new Text2('0.0001%', {
size: 35,
fill: '#ffffff'
}));
pet4ChanceText.anchor.set(0.5, 0);
pet4ChanceText.visible = false;
pet4ChanceText.x = -40;
pet4ChanceText.y = 230; // Below pet4 display
var pet4BoostText = LK.gui.center.addChild(new Text2('Win boost = 60', {
size: 27,
fill: '#ffffff'
}));
pet4BoostText.anchor.set(0.5, 0);
pet4BoostText.visible = false;
pet4BoostText.x = -40;
pet4BoostText.y = 265; // Below chance text
var pet4MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 30', {
size: 23,
fill: '#ffffff'
}));
pet4MuscleBoostText.anchor.set(0.5, 0);
pet4MuscleBoostText.visible = false;
pet4MuscleBoostText.x = -40;
pet4MuscleBoostText.y = 300; // Below win boost text
// Create pet5 display (page 2, top left - highest chance)
var pet5Display = LK.gui.center.addChild(LK.getAsset('pet5', {
anchorX: 0.5,
anchorY: 0.5
}));
pet5Display.visible = false;
pet5Display.x = -280;
pet5Display.y = -140;
var pet5CountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
pet5CountText.anchor.set(0, 1);
pet5CountText.visible = false;
pet5CountText.x = -265 - 50;
pet5CountText.y = -105;
var pet5ChanceText = LK.gui.center.addChild(new Text2('50%', {
size: 35,
fill: '#ffffff'
}));
pet5ChanceText.anchor.set(0.5, 0);
pet5ChanceText.visible = false;
pet5ChanceText.x = -280;
pet5ChanceText.y = -70;
var pet5BoostText = LK.gui.center.addChild(new Text2('Win boost = 0.1', {
size: 27,
fill: '#ffffff'
}));
pet5BoostText.anchor.set(0.5, 0);
pet5BoostText.visible = false;
pet5BoostText.x = -280;
pet5BoostText.y = -35;
var pet5MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.07', {
size: 23,
fill: '#ffffff'
}));
pet5MuscleBoostText.anchor.set(0.5, 0);
pet5MuscleBoostText.visible = false;
pet5MuscleBoostText.x = -280;
pet5MuscleBoostText.y = 0;
// Create pet6 display (page 2, top center - second highest chance)
var pet6Display = LK.gui.center.addChild(LK.getAsset('pet6', {
anchorX: 0.5,
anchorY: 0.5
}));
pet6Display.visible = false;
pet6Display.x = -40;
pet6Display.y = -140;
var pet6CountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
pet6CountText.anchor.set(0, 1);
pet6CountText.visible = false;
pet6CountText.x = -25 - 50;
pet6CountText.y = -105;
var pet6ChanceText = LK.gui.center.addChild(new Text2('20%', {
size: 35,
fill: '#ffffff'
}));
pet6ChanceText.anchor.set(0.5, 0);
pet6ChanceText.visible = false;
pet6ChanceText.x = -40;
pet6ChanceText.y = -70;
var pet6BoostText = LK.gui.center.addChild(new Text2('Win boost = 0.4', {
size: 27,
fill: '#ffffff'
}));
pet6BoostText.anchor.set(0.5, 0);
pet6BoostText.visible = false;
pet6BoostText.x = -40;
pet6BoostText.y = -35;
var pet6MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 0.2', {
size: 23,
fill: '#ffffff'
}));
pet6MuscleBoostText.anchor.set(0.5, 0);
pet6MuscleBoostText.visible = false;
pet6MuscleBoostText.x = -40;
pet6MuscleBoostText.y = 0;
// Create pet7 display (page 2, top right - medium chance)
var pet7Display = LK.gui.center.addChild(LK.getAsset('pet7', {
anchorX: 0.5,
anchorY: 0.5
}));
pet7Display.visible = false;
pet7Display.x = 200;
pet7Display.y = -140;
var pet7CountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
pet7CountText.anchor.set(0, 1);
pet7CountText.visible = false;
pet7CountText.x = 215 - 50;
pet7CountText.y = -105;
var pet7ChanceText = LK.gui.center.addChild(new Text2('5%', {
size: 35,
fill: '#ffffff'
}));
pet7ChanceText.anchor.set(0.5, 0);
pet7ChanceText.visible = false;
pet7ChanceText.x = 200;
pet7ChanceText.y = -70;
var pet7BoostText = LK.gui.center.addChild(new Text2('Win boost = 2', {
size: 27,
fill: '#ffffff'
}));
pet7BoostText.anchor.set(0.5, 0);
pet7BoostText.visible = false;
pet7BoostText.x = 200;
pet7BoostText.y = -35;
var pet7MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 1.2', {
size: 23,
fill: '#ffffff'
}));
pet7MuscleBoostText.anchor.set(0.5, 0);
pet7MuscleBoostText.visible = false;
pet7MuscleBoostText.x = 200;
pet7MuscleBoostText.y = 0;
// Create pet8 display (page 2, bottom left - low chance)
var pet8Display = LK.gui.center.addChild(LK.getAsset('pet8', {
anchorX: 0.5,
anchorY: 0.5
}));
pet8Display.visible = false;
pet8Display.x = -280;
pet8Display.y = 160;
var pet8CountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
pet8CountText.anchor.set(0, 1);
pet8CountText.visible = false;
pet8CountText.x = -265 - 50;
pet8CountText.y = 195;
var pet8ChanceText = LK.gui.center.addChild(new Text2('1%', {
size: 35,
fill: '#ffffff'
}));
pet8ChanceText.anchor.set(0.5, 0);
pet8ChanceText.visible = false;
pet8ChanceText.x = -280;
pet8ChanceText.y = 230;
var pet8BoostText = LK.gui.center.addChild(new Text2('Win boost = 15', {
size: 27,
fill: '#ffffff'
}));
pet8BoostText.anchor.set(0.5, 0);
pet8BoostText.visible = false;
pet8BoostText.x = -280;
pet8BoostText.y = 265;
var pet8MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 10', {
size: 23,
fill: '#ffffff'
}));
pet8MuscleBoostText.anchor.set(0.5, 0);
pet8MuscleBoostText.visible = false;
pet8MuscleBoostText.x = -280;
pet8MuscleBoostText.y = 300;
// Create pet9 display (page 2, bottom center - very low chance)
var pet9Display = LK.gui.center.addChild(LK.getAsset('pet9', {
anchorX: 0.5,
anchorY: 0.5
}));
pet9Display.visible = false;
pet9Display.x = -40;
pet9Display.y = 160;
var pet9CountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
pet9CountText.anchor.set(0, 1);
pet9CountText.visible = false;
pet9CountText.x = -25 - 50;
pet9CountText.y = 195;
var pet9ChanceText = LK.gui.center.addChild(new Text2('0.06%', {
size: 35,
fill: '#ffffff'
}));
pet9ChanceText.anchor.set(0.5, 0);
pet9ChanceText.visible = false;
pet9ChanceText.x = -40;
pet9ChanceText.y = 230;
var pet9BoostText = LK.gui.center.addChild(new Text2('Win boost = 100', {
size: 27,
fill: '#ffffff'
}));
pet9BoostText.anchor.set(0.5, 0);
pet9BoostText.visible = false;
pet9BoostText.x = -40;
pet9BoostText.y = 265;
var pet9MuscleBoostText = LK.gui.center.addChild(new Text2('Muscle boost = 85', {
size: 23,
fill: '#ffffff'
}));
pet9MuscleBoostText.anchor.set(0.5, 0);
pet9MuscleBoostText.visible = false;
pet9MuscleBoostText.x = -40;
pet9MuscleBoostText.y = 300;
// Create secret pet display (page 2, below pet7 - ultra rare)
var petSecretDisplay = LK.gui.center.addChild(LK.getAsset('petSecret', {
anchorX: 0.5,
anchorY: 0.5
}));
petSecretDisplay.visible = false;
petSecretDisplay.x = 200; // Same X as pet7
petSecretDisplay.y = 160; // Same Y as pet9
var petSecretCountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
petSecretCountText.anchor.set(0, 1);
petSecretCountText.visible = false;
petSecretCountText.x = 215 - 50;
petSecretCountText.y = 195;
var petSecretChanceText = LK.gui.center.addChild(new Text2('0.00001%', {
size: 35,
fill: '#ffffff'
}));
petSecretChanceText.anchor.set(0.5, 0);
petSecretChanceText.visible = false;
petSecretChanceText.x = 200;
petSecretChanceText.y = 230;
var petSecretBoostText = LK.gui.center.addChild(new Text2('All muscle boost 5x', {
size: 23,
fill: '#ffffff'
}));
petSecretBoostText.anchor.set(0.5, 0);
petSecretBoostText.visible = false;
petSecretBoostText.x = 200;
petSecretBoostText.y = 265;
var petSecretWinBoostText = LK.gui.center.addChild(new Text2('All win boost 5x', {
size: 23,
fill: '#ffffff'
}));
petSecretWinBoostText.anchor.set(0.5, 0);
petSecretWinBoostText.visible = false;
petSecretWinBoostText.x = 200;
petSecretWinBoostText.y = 300;
// Create rich_water_melon display (page 1, bottom left)
var richWaterMelonDisplay = LK.gui.center.addChild(LK.getAsset('rich_water_melon', {
anchorX: 0.5,
anchorY: 0.5
}));
richWaterMelonDisplay.visible = false;
richWaterMelonDisplay.x = 200;
richWaterMelonDisplay.y = 160;
var richWaterMelonCountText = LK.gui.center.addChild(new Text2('0x', {
size: 55,
fill: '#ffffff'
}));
richWaterMelonCountText.anchor.set(0, 1);
richWaterMelonCountText.visible = false;
richWaterMelonCountText.x = 215 - 50;
richWaterMelonCountText.y = 195;
var richWaterMelonChanceText = LK.gui.center.addChild(new Text2('0.000075%', {
size: 35,
fill: '#ffffff'
}));
richWaterMelonChanceText.anchor.set(0.5, 0);
richWaterMelonChanceText.visible = false;
richWaterMelonChanceText.x = 200;
richWaterMelonChanceText.y = 230;
var richWaterMelonBoostText = LK.gui.center.addChild(new Text2('All secret pets 5x', {
size: 23,
fill: '#ffffff'
}));
richWaterMelonBoostText.anchor.set(0.5, 0);
richWaterMelonBoostText.visible = false;
richWaterMelonBoostText.x = 200;
richWaterMelonBoostText.y = 265;
// Create achievements_1b_win display (page 1, same position as rich_water_melon)
var achievementsDisplay = LK.gui.center.addChild(LK.getAsset('achievements_1b_win', {
anchorX: 0.5,
anchorY: 0.5
}));
achievementsDisplay.visible = false;
achievementsDisplay.x = 200;
achievementsDisplay.y = 160;
var achievementsCountText = LK.gui.center.addChild(new Text2('Always visible', {
size: 35,
fill: '#ffffff'
}));
achievementsCountText.anchor.set(0.5, 0);
achievementsCountText.visible = false;
achievementsCountText.x = 200;
achievementsCountText.y = 230;
var achievementsInfoText = LK.gui.center.addChild(new Text2('Hidden pet placeholder', {
size: 23,
fill: '#ffffff'
}));
achievementsInfoText.anchor.set(0.5, 0);
achievementsInfoText.visible = false;
achievementsInfoText.x = 200;
achievementsInfoText.y = 265;
// Create close1 button for inventory (initially hidden)
var close1Button = LK.gui.center.addChild(LK.getAsset('close', {
anchorX: 0.5,
anchorY: 0.5
}));
close1Button.visible = false;
close1Button.x = 538;
close1Button.y = -315;
// Create next page button for inventory (initially hidden)
var nextPageButton = LK.gui.center.addChild(LK.getAsset('nextPage', {
anchorX: 0.5,
anchorY: 0.5
}));
nextPageButton.visible = false;
nextPageButton.x = close1Button.x;
nextPageButton.y = close1Button.y + 150;
// Add text to next page button
var nextPageText = new Text2('Next', {
size: 35,
fill: '#ffffff'
});
nextPageText.anchor.set(0.5, 0.5);
nextPageButton.addChild(nextPageText);
// Create previous page button for inventory (initially hidden)
var prevPageButton = LK.gui.center.addChild(LK.getAsset('prevPage', {
anchorX: 0.5,
anchorY: 0.5
}));
prevPageButton.visible = false;
prevPageButton.x = -close1Button.x; // Left side, opposite of close button
prevPageButton.y = close1Button.y + 150; // Same Y as next button
// Add text to previous page button
var prevPageText = new Text2('Prev', {
size: 35,
fill: '#ffffff'
});
prevPageText.anchor.set(0.5, 0.5);
prevPageButton.addChild(prevPageText);
// Create page number display for inventory (initially hidden)
var pageNumberDisplay = LK.gui.center.addChild(new Text2('Page 1/2', {
size: 40,
fill: '#ffffff'
}));
pageNumberDisplay.anchor.set(0.5, 0);
pageNumberDisplay.visible = false;
pageNumberDisplay.x = 0;
pageNumberDisplay.y = -265;
// Create shopping image UI element (initially hidden)
var shoppingImage = LK.gui.center.addChild(LK.getAsset('shopping', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
}));
shoppingImage.visible = false;
// Create close button UI element (initially hidden)
var closeButton = LK.gui.center.addChild(LK.getAsset('close', {
anchorX: 0.5,
anchorY: 0.5
}));
closeButton.visible = false;
closeButton.x = 310; // Position close button to the right of shopping image
closeButton.y = -310; // Position close button at the top of shopping image
// Add shop upgrade text
var shopUpgradeText = LK.gui.center.addChild(new Text2(formatNumber(shopPrice) + ' muscle = + ' + formatNumber(1) + ' muscle boost', {
size: 45,
fill: '#ffffff',
font: 'bold serif'
}));
shopUpgradeText.anchor.set(0.5, 0.5);
shopUpgradeText.x = 0;
shopUpgradeText.y = -200;
shopUpgradeText.visible = false;
// Add luck boost upgrade text
var luckUpgradeText = LK.gui.center.addChild(new Text2(formatNumber(luckPrice) + ' win = + 1 luck boost', {
size: 45,
fill: '#ffffff',
font: 'bold serif'
}));
luckUpgradeText.anchor.set(0.5, 0.5);
luckUpgradeText.x = 0;
luckUpgradeText.y = -100;
luckUpgradeText.visible = false;
// Add win boost display in bottom left
var winBoostDisplay = LK.gui.bottomLeft.addChild(new Text2('Win Boost: ' + formatNumber(totalWinBoost), {
size: 50,
fill: '#ffffff'
}));
winBoostDisplay.anchor.set(0, 1);
winBoostDisplay.x = 20;
winBoostDisplay.y = -20;
// Add muscle boost display in bottom left
var muscleBoostDisplay = LK.gui.bottomLeft.addChild(new Text2('Muscle Boost: ' + formatNumber(muscleBoost + totalPetMuscleBoost), {
size: 50,
fill: '#ffffff',
font: 'bold serif'
}));
muscleBoostDisplay.anchor.set(0, 1);
muscleBoostDisplay.x = 20;
muscleBoostDisplay.y = -80;
// Add version display above luck boost
var versionDisplay = LK.gui.bottomLeft.addChild(new Text2('version: beta', {
size: 80,
fill: '#ffffff'
}));
versionDisplay.anchor.set(0, 1);
versionDisplay.x = 20;
versionDisplay.y = -230;
// Add luck boost display in bottom left
var luckBoostDisplay = LK.gui.bottomLeft.addChild(new Text2('Luck Boost: ' + formatNumber(luckBoost), {
size: 50,
fill: '#ffffff'
}));
luckBoostDisplay.anchor.set(0, 1);
luckBoostDisplay.x = 20;
luckBoostDisplay.y = -140;
// Add close button text
var closeShopText = new Text2('Close', {
size: 50,
fill: '#ff0000'
});
closeShopText.anchor.set(0.5, 0.5);
closeShopText.x = 0;
closeShopText.y = 200;
shopUI.addChild(closeShopText);
game.down = function (x, y, obj) {
// Check if inventory UI is open
if (isInventoryOpen) {
// Check if close1 button was clicked (convert screen coordinates to GUI coordinates)
var screenY = y * (LK.gui.height / 2732);
var screenX = x * (LK.gui.width / 2048);
var guiCenterX = LK.gui.width / 2;
var guiCenterY = LK.gui.height / 2;
// Calculate close1 button bounds in screen coordinates
var close1Bounds = {
left: guiCenterX + close1Button.x - 50,
right: guiCenterX + close1Button.x + 50,
top: guiCenterY + close1Button.y - 50,
bottom: guiCenterY + close1Button.y + 50
};
if (screenX >= close1Bounds.left && screenX <= close1Bounds.right && screenY >= close1Bounds.top && screenY <= close1Bounds.bottom) {
// Close inventory
isInventoryOpen = false;
inInventoryImage.visible = false;
close1Button.visible = false;
nextPageButton.visible = false;
prevPageButton.visible = false;
pageNumberDisplay.visible = false;
// Hide pet displays
petDisplay.visible = false;
pet1Display.visible = false;
pet2Display.visible = false;
pet3Display.visible = false;
pet4Display.visible = false;
petCountText.visible = false;
pet1CountText.visible = false;
pet2CountText.visible = false;
pet3CountText.visible = false;
pet4CountText.visible = false;
petChanceText.visible = false;
petBoostText.visible = false;
pet1ChanceText.visible = false;
pet1BoostText.visible = false;
pet2ChanceText.visible = false;
pet2BoostText.visible = false;
pet3ChanceText.visible = false;
pet3BoostText.visible = false;
pet4ChanceText.visible = false;
pet4BoostText.visible = false;
petMuscleBoostText.visible = false;
pet1MuscleBoostText.visible = false;
pet2MuscleBoostText.visible = false;
pet3MuscleBoostText.visible = false;
pet4MuscleBoostText.visible = false;
// Hide page 2 pet displays
pet5Display.visible = false;
pet6Display.visible = false;
pet7Display.visible = false;
pet8Display.visible = false;
pet9Display.visible = false;
petSecretDisplay.visible = false;
pet5CountText.visible = false;
pet6CountText.visible = false;
pet7CountText.visible = false;
pet8CountText.visible = false;
pet9CountText.visible = false;
petSecretCountText.visible = false;
pet5ChanceText.visible = false;
pet6ChanceText.visible = false;
pet7ChanceText.visible = false;
pet8ChanceText.visible = false;
pet9ChanceText.visible = false;
petSecretChanceText.visible = false;
pet5BoostText.visible = false;
pet6BoostText.visible = false;
pet7BoostText.visible = false;
pet8BoostText.visible = false;
pet9BoostText.visible = false;
petSecretBoostText.visible = false;
pet5MuscleBoostText.visible = false;
pet6MuscleBoostText.visible = false;
pet7MuscleBoostText.visible = false;
pet8MuscleBoostText.visible = false;
pet9MuscleBoostText.visible = false;
petSecretWinBoostText.visible = false;
richWaterMelonDisplay.visible = false;
richWaterMelonCountText.visible = false;
richWaterMelonChanceText.visible = false;
richWaterMelonBoostText.visible = false;
achievementsDisplay.visible = false;
achievementsCountText.visible = false;
achievementsInfoText.visible = false;
return;
}
// Calculate next page button bounds in screen coordinates
var nextPageBounds = {
left: guiCenterX + nextPageButton.x - 60,
right: guiCenterX + nextPageButton.x + 60,
top: guiCenterY + nextPageButton.y - 40,
bottom: guiCenterY + nextPageButton.y + 40
};
if (screenX >= nextPageBounds.left && screenX <= nextPageBounds.right && screenY >= nextPageBounds.top && screenY <= nextPageBounds.bottom) {
// Switch to next page
currentInventoryPage = currentInventoryPage + 1;
if (currentInventoryPage > maxInventoryPages) {
currentInventoryPage = 1; // Loop back to first page
}
// Update page display
pageNumberDisplay.setText('Page ' + currentInventoryPage + '/' + maxInventoryPages);
// Hide all pet displays first
petDisplay.visible = false;
pet1Display.visible = false;
pet2Display.visible = false;
pet3Display.visible = false;
pet4Display.visible = false;
petCountText.visible = false;
pet1CountText.visible = false;
pet2CountText.visible = false;
pet3CountText.visible = false;
pet4CountText.visible = false;
petChanceText.visible = false;
petBoostText.visible = false;
pet1ChanceText.visible = false;
pet1BoostText.visible = false;
pet2ChanceText.visible = false;
pet2BoostText.visible = false;
pet3ChanceText.visible = false;
pet3BoostText.visible = false;
pet4ChanceText.visible = false;
pet4BoostText.visible = false;
petMuscleBoostText.visible = false;
pet1MuscleBoostText.visible = false;
pet2MuscleBoostText.visible = false;
pet3MuscleBoostText.visible = false;
pet4MuscleBoostText.visible = false;
// Hide new pet displays
pet5Display.visible = false;
pet6Display.visible = false;
pet7Display.visible = false;
pet8Display.visible = false;
pet9Display.visible = false;
petSecretDisplay.visible = false;
pet5CountText.visible = false;
pet6CountText.visible = false;
pet7CountText.visible = false;
pet8CountText.visible = false;
pet9CountText.visible = false;
petSecretCountText.visible = false;
pet5ChanceText.visible = false;
pet6ChanceText.visible = false;
pet7ChanceText.visible = false;
pet8ChanceText.visible = false;
pet9ChanceText.visible = false;
petSecretChanceText.visible = false;
pet5BoostText.visible = false;
pet6BoostText.visible = false;
pet7BoostText.visible = false;
pet8BoostText.visible = false;
pet9BoostText.visible = false;
petSecretBoostText.visible = false;
pet5MuscleBoostText.visible = false;
pet6MuscleBoostText.visible = false;
pet7MuscleBoostText.visible = false;
pet8MuscleBoostText.visible = false;
pet9MuscleBoostText.visible = false;
petSecretWinBoostText.visible = false;
richWaterMelonDisplay.visible = false;
richWaterMelonCountText.visible = false;
richWaterMelonChanceText.visible = false;
richWaterMelonBoostText.visible = false;
achievementsDisplay.visible = false;
achievementsCountText.visible = false;
achievementsInfoText.visible = false;
// Show pets based on current page
pet5Display.visible = false;
pet6Display.visible = false;
pet7Display.visible = false;
pet8Display.visible = false;
pet9Display.visible = false;
petSecretDisplay.visible = false;
pet5CountText.visible = false;
pet6CountText.visible = false;
pet7CountText.visible = false;
pet8CountText.visible = false;
pet9CountText.visible = false;
petSecretCountText.visible = false;
pet5ChanceText.visible = false;
pet6ChanceText.visible = false;
pet7ChanceText.visible = false;
pet8ChanceText.visible = false;
pet9ChanceText.visible = false;
petSecretChanceText.visible = false;
pet5BoostText.visible = false;
pet6BoostText.visible = false;
pet7BoostText.visible = false;
pet8BoostText.visible = false;
pet9BoostText.visible = false;
petSecretBoostText.visible = false;
pet5MuscleBoostText.visible = false;
pet6MuscleBoostText.visible = false;
pet7MuscleBoostText.visible = false;
pet8MuscleBoostText.visible = false;
pet9MuscleBoostText.visible = false;
petSecretWinBoostText.visible = false;
// Show pets based on current page
if (currentInventoryPage === 1) {
// Page 1: Show all pets (pet, pet1, pet2, pet3, pet4)
// Calculate dynamic chances with luck boost
var luckMultiplier = 1 + luckBoost * 0.25;
var basePetChance = Math.max(0, 70 * Math.pow(0.95, luckBoost));
var basePet1Chance = Math.max(0, 30 * Math.pow(0.96, luckBoost));
var basePet2Chance = Math.max(0, 10 * Math.pow(0.97, luckBoost));
var basePet3Chance = 1;
var basePet4Chance = 0.05;
var finalPetChance = basePetChance;
var finalPet1Chance = basePet1Chance;
var finalPet2Chance = basePet2Chance;
var finalPet3Chance = basePet3Chance * luckMultiplier;
var finalPet4Chance = basePet4Chance * luckMultiplier;
if (petCount > 0) {
petDisplay.visible = true;
petCountText.visible = true;
petCountText.setText(formatNumber(petCount) + 'x');
petChanceText.visible = true;
petChanceText.setText(formatNumber(finalPetChance) + '%');
petBoostText.visible = true;
petBoostText.setText('Win boost = ' + formatNumber(petCount * 0.02));
petMuscleBoostText.visible = true;
petMuscleBoostText.setText('Muscle boost = ' + formatNumber(petCount * 0.01));
}
if (pet1Count > 0) {
pet1Display.visible = true;
pet1CountText.visible = true;
pet1CountText.setText(formatNumber(pet1Count) + 'x');
pet1ChanceText.visible = true;
pet1ChanceText.setText(formatNumber(finalPet1Chance) + '%');
pet1BoostText.visible = true;
pet1BoostText.setText('Win boost = ' + formatNumber(pet1Count * 0.06));
pet1MuscleBoostText.visible = true;
pet1MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet1Count * 0.03));
}
if (pet2Count > 0) {
pet2Display.visible = true;
pet2CountText.visible = true;
pet2CountText.setText(formatNumber(pet2Count) + 'x');
pet2ChanceText.visible = true;
pet2ChanceText.setText(formatNumber(finalPet2Chance) + '%');
pet2BoostText.visible = true;
pet2BoostText.setText('Win boost = ' + formatNumber(pet2Count * 0.2));
pet2MuscleBoostText.visible = true;
pet2MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet2Count * 0.1));
}
if (pet3Count > 0) {
pet3Display.visible = true;
pet3CountText.visible = true;
pet3CountText.setText(formatNumber(pet3Count) + 'x');
pet3ChanceText.visible = true;
pet3ChanceText.setText(formatNumber(finalPet3Chance) + '%');
pet3BoostText.visible = true;
pet3BoostText.setText('Win boost = ' + formatNumber(pet3Count * 1.5));
pet3MuscleBoostText.visible = true;
pet3MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet3Count * 0.75));
}
if (pet4Count > 0) {
pet4Display.visible = true;
pet4CountText.visible = true;
pet4CountText.setText(formatNumber(pet4Count) + 'x');
pet4ChanceText.visible = true;
pet4ChanceText.setText(formatNumber(finalPet4Chance) + '%');
pet4BoostText.visible = true;
pet4BoostText.setText('Win boost = ' + formatNumber(pet4Count * 60));
pet4MuscleBoostText.visible = true;
pet4MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet4Count * 30));
}
// Always show rich_water_melon or achievements_1b_win with all text
var hiddenPetMultiplier = 1 + luckBoost * 0.25;
var hiddenPetChance = 0.000075 * hiddenPetMultiplier;
if (richWaterMelonCount > 0) {
// Show rich_water_melon since we have it
richWaterMelonDisplay.visible = true;
richWaterMelonCountText.visible = true;
richWaterMelonCountText.setText(formatNumber(richWaterMelonCount) + 'x');
richWaterMelonChanceText.visible = true;
richWaterMelonChanceText.setText(hiddenPetChance.toFixed(6) + '%');
richWaterMelonBoostText.visible = true;
} else {
// Show achievements_1b_win as placeholder
achievementsDisplay.visible = true;
achievementsCountText.visible = true;
achievementsCountText.setText(hiddenPetChance.toFixed(6) + '%');
achievementsInfoText.visible = true;
achievementsInfoText.setText('All secret pets 5x');
}
} else if (currentInventoryPage === 2) {
// Page 2: Show new pets (pet5-pet9 and petSecret)
// Calculate dynamic chances with luck boost for page 2 pets
var luckMultiplier = 1 + luckBoost * 0.25;
var basePet5Chance = Math.max(0, 50 * Math.pow(0.90, luckBoost)); // Pet5 decreases by 10%
var basePet6Chance = Math.max(0, 20 * Math.pow(0.925, luckBoost)); // Pet6 decreases by 7.5%
var basePet7Chance = 5 * luckMultiplier; // Pet7 increases by 25%
var basePet8Chance = 1 * luckMultiplier; // Pet8 increases by 25%
var basePet9Chance = 0.06 * luckMultiplier; // Pet9 increases by 25%
var basePetSecretChance = 0.0001 * luckMultiplier; // Secret increases by 25%
// Always show all pets on page 2 with correct assets and all text
// Pet5 - always show with text
if (pet5Count > 0) {
// Change to actual pet5 asset since we have at least one
pet5Display.removeChildren();
pet5Display.addChild(LK.getAsset('pet5', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Use _D asset since we don't have any
pet5Display.removeChildren();
pet5Display.addChild(LK.getAsset('pet5_D', {
anchorX: 0.5,
anchorY: 0.5
}));
}
pet5Display.visible = true;
pet5CountText.visible = true;
pet5CountText.setText(formatNumber(pet5Count) + 'x');
pet5ChanceText.visible = true;
pet5ChanceText.setText(formatNumber(basePet5Chance) + '%');
pet5BoostText.visible = true;
pet5BoostText.setText('Win boost = ' + formatNumber(pet5Count * 0.1));
pet5MuscleBoostText.visible = true;
pet5MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet5Count * 0.07));
// Pet6 - always show with text
if (pet6Count > 0) {
// Change to actual pet6 asset since we have at least one
pet6Display.removeChildren();
pet6Display.addChild(LK.getAsset('pet6', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Use _D asset since we don't have any
pet6Display.removeChildren();
pet6Display.addChild(LK.getAsset('pet6_D', {
anchorX: 0.5,
anchorY: 0.5
}));
}
pet6Display.visible = true;
pet6CountText.visible = true;
pet6CountText.setText(formatNumber(pet6Count) + 'x');
pet6ChanceText.visible = true;
pet6ChanceText.setText(formatNumber(basePet6Chance) + '%');
pet6BoostText.visible = true;
pet6BoostText.setText('Win boost = ' + formatNumber(pet6Count * 0.4));
pet6MuscleBoostText.visible = true;
pet6MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet6Count * 0.2));
// Pet7 - always show with text
if (pet7Count > 0) {
// Change to actual pet7 asset since we have at least one
pet7Display.removeChildren();
pet7Display.addChild(LK.getAsset('pet7', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Use _D asset since we don't have any
pet7Display.removeChildren();
pet7Display.addChild(LK.getAsset('pet7_D', {
anchorX: 0.5,
anchorY: 0.5
}));
}
pet7Display.visible = true;
pet7CountText.visible = true;
pet7CountText.setText(formatNumber(pet7Count) + 'x');
pet7ChanceText.visible = true;
pet7ChanceText.setText(formatNumber(basePet7Chance) + '%');
pet7BoostText.visible = true;
pet7BoostText.setText('Win boost = ' + formatNumber(pet7Count * 2));
pet7MuscleBoostText.visible = true;
pet7MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet7Count * 1.2));
// Pet8 - always show with text
if (pet8Count > 0) {
// Change to actual pet8 asset since we have at least one
pet8Display.removeChildren();
pet8Display.addChild(LK.getAsset('pet8', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Use _D asset since we don't have any
pet8Display.removeChildren();
pet8Display.addChild(LK.getAsset('pet8_D', {
anchorX: 0.5,
anchorY: 0.5
}));
}
pet8Display.visible = true;
pet8CountText.visible = true;
pet8CountText.setText(formatNumber(pet8Count) + 'x');
pet8ChanceText.visible = true;
pet8ChanceText.setText(formatNumber(basePet8Chance) + '%');
pet8BoostText.visible = true;
pet8BoostText.setText('Win boost = ' + formatNumber(pet8Count * 15));
pet8MuscleBoostText.visible = true;
pet8MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet8Count * 10));
// Pet9 - always show with text
if (pet9Count > 0) {
// Change to actual pet9 asset since we have at least one
pet9Display.removeChildren();
pet9Display.addChild(LK.getAsset('pet9', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Use _D asset since we don't have any
pet9Display.removeChildren();
pet9Display.addChild(LK.getAsset('pet9_D', {
anchorX: 0.5,
anchorY: 0.5
}));
}
pet9Display.visible = true;
pet9CountText.visible = true;
pet9CountText.setText(formatNumber(pet9Count) + 'x');
pet9ChanceText.visible = true;
pet9ChanceText.setText(formatNumber(basePet9Chance) + '%');
pet9BoostText.visible = true;
pet9BoostText.setText('Win boost = ' + formatNumber(pet9Count * 100));
pet9MuscleBoostText.visible = true;
pet9MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet9Count * 85));
// PetSecret - always show with text
if (petSecretCount > 0) {
// Change to actual petSecret asset since we have at least one
petSecretDisplay.removeChildren();
petSecretDisplay.addChild(LK.getAsset('petSecret', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Use _D asset since we don't have any
petSecretDisplay.removeChildren();
petSecretDisplay.addChild(LK.getAsset('petSecret_D', {
anchorX: 0.5,
anchorY: 0.5
}));
}
petSecretDisplay.visible = true;
petSecretCountText.visible = true;
petSecretCountText.setText(formatNumber(petSecretCount) + 'x');
petSecretChanceText.visible = true;
petSecretChanceText.setText(basePetSecretChance.toFixed(6) + '%');
petSecretBoostText.visible = true;
petSecretWinBoostText.visible = true;
}
return;
}
// Calculate previous page button bounds in screen coordinates
var prevPageBounds = {
left: guiCenterX + prevPageButton.x - 60,
right: guiCenterX + prevPageButton.x + 60,
top: guiCenterY + prevPageButton.y - 40,
bottom: guiCenterY + prevPageButton.y + 40
};
if (screenX >= prevPageBounds.left && screenX <= prevPageBounds.right && screenY >= prevPageBounds.top && screenY <= prevPageBounds.bottom) {
// Switch to previous page
currentInventoryPage = currentInventoryPage - 1;
if (currentInventoryPage < 1) {
currentInventoryPage = maxInventoryPages; // Loop back to last page
}
// Update page display
pageNumberDisplay.setText('Page ' + currentInventoryPage + '/' + maxInventoryPages);
// Hide all pet displays first
petDisplay.visible = false;
pet1Display.visible = false;
pet2Display.visible = false;
pet3Display.visible = false;
pet4Display.visible = false;
petCountText.visible = false;
pet1CountText.visible = false;
pet2CountText.visible = false;
pet3CountText.visible = false;
pet4CountText.visible = false;
petChanceText.visible = false;
petBoostText.visible = false;
pet1ChanceText.visible = false;
pet1BoostText.visible = false;
pet2ChanceText.visible = false;
pet2BoostText.visible = false;
pet3ChanceText.visible = false;
pet3BoostText.visible = false;
pet4ChanceText.visible = false;
pet4BoostText.visible = false;
petMuscleBoostText.visible = false;
pet1MuscleBoostText.visible = false;
pet2MuscleBoostText.visible = false;
pet3MuscleBoostText.visible = false;
pet4MuscleBoostText.visible = false;
// Hide new pet displays
pet5Display.visible = false;
pet6Display.visible = false;
pet7Display.visible = false;
pet8Display.visible = false;
pet9Display.visible = false;
petSecretDisplay.visible = false;
pet5CountText.visible = false;
pet6CountText.visible = false;
pet7CountText.visible = false;
pet8CountText.visible = false;
pet9CountText.visible = false;
petSecretCountText.visible = false;
pet5ChanceText.visible = false;
pet6ChanceText.visible = false;
pet7ChanceText.visible = false;
pet8ChanceText.visible = false;
pet9ChanceText.visible = false;
petSecretChanceText.visible = false;
pet5BoostText.visible = false;
pet6BoostText.visible = false;
pet7BoostText.visible = false;
pet8BoostText.visible = false;
pet9BoostText.visible = false;
petSecretBoostText.visible = false;
pet5MuscleBoostText.visible = false;
pet6MuscleBoostText.visible = false;
pet7MuscleBoostText.visible = false;
pet8MuscleBoostText.visible = false;
pet9MuscleBoostText.visible = false;
petSecretWinBoostText.visible = false;
richWaterMelonDisplay.visible = false;
richWaterMelonCountText.visible = false;
richWaterMelonChanceText.visible = false;
richWaterMelonBoostText.visible = false;
achievementsDisplay.visible = false;
achievementsCountText.visible = false;
achievementsInfoText.visible = false;
// Show pets based on current page
if (currentInventoryPage === 1) {
// Page 1: Show all pets (pet, pet1, pet2, pet3, pet4)
// Calculate dynamic chances with luck boost
var luckMultiplier = 1 + luckBoost * 0.25;
var basePetChance = Math.max(0, 70 * Math.pow(0.95, luckBoost));
var basePet1Chance = Math.max(0, 30 * Math.pow(0.96, luckBoost));
var basePet2Chance = Math.max(0, 10 * Math.pow(0.97, luckBoost));
var basePet3Chance = 1;
var basePet4Chance = 0.05;
var finalPetChance = basePetChance;
var finalPet1Chance = basePet1Chance;
var finalPet2Chance = basePet2Chance;
var finalPet3Chance = basePet3Chance * luckMultiplier;
var finalPet4Chance = basePet4Chance * luckMultiplier;
if (petCount > 0) {
petDisplay.visible = true;
petCountText.visible = true;
petCountText.setText(formatNumber(petCount) + 'x');
petChanceText.visible = true;
petChanceText.setText(formatNumber(finalPetChance) + '%');
petBoostText.visible = true;
petBoostText.setText('Win boost = ' + formatNumber(petCount * 0.02));
petMuscleBoostText.visible = true;
petMuscleBoostText.setText('Muscle boost = ' + formatNumber(petCount * 0.01));
}
if (pet1Count > 0) {
pet1Display.visible = true;
pet1CountText.visible = true;
pet1CountText.setText(formatNumber(pet1Count) + 'x');
pet1ChanceText.visible = true;
pet1ChanceText.setText(formatNumber(finalPet1Chance) + '%');
pet1BoostText.visible = true;
pet1BoostText.setText('Win boost = ' + formatNumber(pet1Count * 0.06));
pet1MuscleBoostText.visible = true;
pet1MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet1Count * 0.03));
}
if (pet2Count > 0) {
pet2Display.visible = true;
pet2CountText.visible = true;
pet2CountText.setText(formatNumber(pet2Count) + 'x');
pet2ChanceText.visible = true;
pet2ChanceText.setText(formatNumber(finalPet2Chance) + '%');
pet2BoostText.visible = true;
pet2BoostText.setText('Win boost = ' + formatNumber(pet2Count * 0.2));
pet2MuscleBoostText.visible = true;
pet2MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet2Count * 0.1));
}
if (pet3Count > 0) {
pet3Display.visible = true;
pet3CountText.visible = true;
pet3CountText.setText(formatNumber(pet3Count) + 'x');
pet3ChanceText.visible = true;
pet3ChanceText.setText(formatNumber(finalPet3Chance) + '%');
pet3BoostText.visible = true;
pet3BoostText.setText('Win boost = ' + formatNumber(pet3Count * 1.5));
pet3MuscleBoostText.visible = true;
pet3MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet3Count * 0.75));
}
if (pet4Count > 0) {
pet4Display.visible = true;
pet4CountText.visible = true;
pet4CountText.setText(formatNumber(pet4Count) + 'x');
pet4ChanceText.visible = true;
pet4ChanceText.setText(formatNumber(finalPet4Chance) + '%');
pet4BoostText.visible = true;
pet4BoostText.setText('Win boost = ' + formatNumber(pet4Count * 60));
pet4MuscleBoostText.visible = true;
pet4MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet4Count * 30));
}
// Always show rich_water_melon or achievements_1b_win with all text
var hiddenPetMultiplier = 1 + luckBoost * 0.25;
var hiddenPetChance = 0.000075 * hiddenPetMultiplier;
if (richWaterMelonCount > 0) {
// Show rich_water_melon since we have it
richWaterMelonDisplay.visible = true;
richWaterMelonCountText.visible = true;
richWaterMelonCountText.setText(formatNumber(richWaterMelonCount) + 'x');
richWaterMelonChanceText.visible = true;
richWaterMelonChanceText.setText(hiddenPetChance.toFixed(6) + '%');
richWaterMelonBoostText.visible = true;
} else {
// Show achievements_1b_win as placeholder
achievementsDisplay.visible = true;
achievementsCountText.visible = true;
achievementsCountText.setText(hiddenPetChance.toFixed(6) + '%');
achievementsInfoText.visible = true;
achievementsInfoText.setText('All secret pets 5x');
}
} else if (currentInventoryPage === 2) {
// Page 2: Show new pets (pet5-pet9 and petSecret)
// Calculate dynamic chances with luck boost for page 2 pets
var luckMultiplier = 1 + luckBoost * 0.25;
var basePet5Chance = Math.max(0, 50 * Math.pow(0.90, luckBoost)); // Pet5 decreases by 10%
var basePet6Chance = Math.max(0, 20 * Math.pow(0.925, luckBoost)); // Pet6 decreases by 7.5%
var basePet7Chance = 5 * luckMultiplier; // Pet7 increases by 25%
var basePet8Chance = 1 * luckMultiplier; // Pet8 increases by 25%
var basePet9Chance = 0.06 * luckMultiplier; // Pet9 increases by 25%
var basePetSecretChance = 0.0001 * luckMultiplier; // Secret increases by 25%
if (pet5Count > 0) {
pet5Display.visible = true;
pet5CountText.visible = true;
pet5CountText.setText(formatNumber(pet5Count) + 'x');
pet5ChanceText.visible = true;
pet5ChanceText.setText(formatNumber(basePet5Chance) + '%');
pet5BoostText.visible = true;
pet5BoostText.setText('Win boost = ' + formatNumber(pet5Count * 0.1));
pet5MuscleBoostText.visible = true;
pet5MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet5Count * 0.07));
}
if (pet6Count > 0) {
pet6Display.visible = true;
pet6CountText.visible = true;
pet6CountText.setText(formatNumber(pet6Count) + 'x');
pet6ChanceText.visible = true;
pet6ChanceText.setText(formatNumber(basePet6Chance) + '%');
pet6BoostText.visible = true;
pet6BoostText.setText('Win boost = ' + formatNumber(pet6Count * 0.4));
pet6MuscleBoostText.visible = true;
pet6MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet6Count * 0.2));
}
if (pet7Count > 0) {
pet7Display.visible = true;
pet7CountText.visible = true;
pet7CountText.setText(formatNumber(pet7Count) + 'x');
pet7ChanceText.visible = true;
pet7ChanceText.setText(formatNumber(basePet7Chance) + '%');
pet7BoostText.visible = true;
pet7BoostText.setText('Win boost = ' + formatNumber(pet7Count * 2));
pet7MuscleBoostText.visible = true;
pet7MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet7Count * 1.2));
}
if (pet8Count > 0) {
pet8Display.visible = true;
pet8CountText.visible = true;
pet8CountText.setText(formatNumber(pet8Count) + 'x');
pet8ChanceText.visible = true;
pet8ChanceText.setText(formatNumber(basePet8Chance) + '%');
pet8BoostText.visible = true;
pet8BoostText.setText('Win boost = ' + formatNumber(pet8Count * 15));
pet8MuscleBoostText.visible = true;
pet8MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet8Count * 10));
}
if (pet9Count > 0) {
pet9Display.visible = true;
pet9CountText.visible = true;
pet9CountText.setText(formatNumber(pet9Count) + 'x');
pet9ChanceText.visible = true;
pet9ChanceText.setText(formatNumber(basePet9Chance) + '%');
pet9BoostText.visible = true;
pet9BoostText.setText('Win boost = ' + formatNumber(pet9Count * 100));
pet9MuscleBoostText.visible = true;
pet9MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet9Count * 85));
}
if (petSecretCount > 0) {
petSecretDisplay.visible = true;
petSecretCountText.visible = true;
petSecretCountText.setText(formatNumber(petSecretCount) + 'x');
petSecretChanceText.visible = true;
petSecretChanceText.setText(basePetSecretChance.toFixed(6) + '%');
petSecretBoostText.visible = true;
petSecretWinBoostText.visible = true;
}
}
return;
}
return;
}
// Check if shop UI is open
if (isShopOpen) {
// Check if close button was clicked (convert screen coordinates to GUI coordinates)
var screenY = y * (LK.gui.height / 2732);
var screenX = x * (LK.gui.width / 2048);
var guiCenterX = LK.gui.width / 2;
var guiCenterY = LK.gui.height / 2;
// Calculate close button bounds in screen coordinates
var closeBounds = {
left: guiCenterX + closeButton.x - 50,
right: guiCenterX + closeButton.x + 50,
top: guiCenterY + closeButton.y - 50,
bottom: guiCenterY + closeButton.y + 50
};
if (screenX >= closeBounds.left && screenX <= closeBounds.right && screenY >= closeBounds.top && screenY <= closeBounds.bottom) {
// Close shop
isShopOpen = false;
shoppingImage.visible = false;
closeButton.visible = false;
shopUpgradeText.visible = false;
luckUpgradeText.visible = false;
return;
}
// Calculate shop upgrade text bounds in screen coordinates
var upgradeBounds = {
left: guiCenterX - 200,
// Approximate text width bounds
right: guiCenterX + 200,
top: guiCenterY + shopUpgradeText.y - 30,
// Approximate text height bounds
bottom: guiCenterY + shopUpgradeText.y + 30
};
if (screenX >= upgradeBounds.left && screenX <= upgradeBounds.right && screenY >= upgradeBounds.top && screenY <= upgradeBounds.bottom) {
// Check if player has enough muscle to buy upgrade
if (muscle >= shopPrice) {
// Deduct muscle and add boost
muscle = Math.round((muscle - shopPrice) * 10) / 10;
// Always add the base boost amount (1.5)
muscleBoost = Math.round((muscleBoost + shopBoostAmount) * 10) / 10;
// Multiply the price by 1.5x for next upgrade
shopPrice = Math.round(shopPrice * 1.5);
// Save to storage
storage.muscle = muscle;
storage.muscleBoost = muscleBoost;
storage.shopPrice = shopPrice;
// Update shop text - show the next boost amount that will be added (always 1.5)
shopUpgradeText.setText(formatNumber(shopPrice) + ' muscle = + ' + formatNumber(shopBoostAmount) + ' muscle boost');
// Update muscle boost display
muscleBoostDisplay.setText('Muscle Boost: ' + formatNumber(muscleBoost + totalPetMuscleBoost));
}
return;
}
// Calculate luck upgrade text bounds in screen coordinates
var luckUpgradeBounds = {
left: guiCenterX - 200,
right: guiCenterX + 200,
top: guiCenterY + luckUpgradeText.y - 30,
bottom: guiCenterY + luckUpgradeText.y + 30
};
if (screenX >= luckUpgradeBounds.left && screenX <= luckUpgradeBounds.right && screenY >= luckUpgradeBounds.top && screenY <= luckUpgradeBounds.bottom) {
// Check if player has enough wins to buy luck boost
if (win >= luckPrice) {
// Deduct wins and add luck boost
win -= luckPrice;
luckBoost += 1;
// Multiply the price by 10x for next upgrade
luckPrice = luckPrice * 10;
// Save to storage
storage.win = win;
storage.luckBoost = luckBoost;
storage.luckPrice = luckPrice;
// Update luck upgrade text
luckUpgradeText.setText(formatNumber(luckPrice) + ' win = + 1 luck boost');
// Update luck boost display
luckBoostDisplay.setText('Luck Boost: ' + formatNumber(luckBoost));
}
return;
}
return;
}
// Check if shop was clicked (convert screen coordinates to GUI coordinates)
var screenY = y * (LK.gui.height / 2732);
var screenX = x * (LK.gui.width / 2048);
// Calculate shop bounds more accurately for bottom-right position
var shopBounds = {
left: LK.gui.width + shop.x - shop.width * 0.15,
// Account for right anchor and scale
right: LK.gui.width + shop.x,
top: LK.gui.height + shop.y - shop.height * 0.15,
// Account for anchor and scale
bottom: LK.gui.height + shop.y
};
if (screenX >= shopBounds.left && screenX <= shopBounds.right && screenY >= shopBounds.top && screenY <= shopBounds.bottom) {
// Open shop (don't toggle, only open)
if (!isShopOpen) {
isShopOpen = true;
shoppingImage.visible = true;
closeButton.visible = true;
shopUpgradeText.visible = true;
luckUpgradeText.visible = true;
// Update shop upgrade text with current values - show the next boost amount (always 1.5)
shopUpgradeText.setText(formatNumber(shopPrice) + ' muscle = + ' + formatNumber(shopBoostAmount) + ' muscle boost');
// Update luck upgrade text with current values
luckUpgradeText.setText(formatNumber(luckPrice) + ' win = + 1 luck boost');
}
return;
}
// Check if egg was clicked
var eggLeft = egg.x - 75;
var eggRight = egg.x + 75;
var eggTop = egg.y - 75;
var eggBottom = egg.y + 75;
if (x >= eggLeft && x <= eggRight && y >= eggTop && y <= eggBottom && win >= 200) {
// Deduct 200 win points
win -= 200;
storage.win = win;
// Pet chances with luck boost and cascading decrease system
var luckMultiplier = 1 + luckBoost * 0.25;
// Hidden pet chance (rich_water_melon) - 0.000075% base chance, increased by 25% per luck boost
var hiddenPetChance = 0.000075 * luckMultiplier;
// Pet (first pet) decreases by 5% per luck boost from base 70%, can reach 0
var basePetChance = Math.max(0, 70 * Math.pow(0.95, luckBoost));
// Pet1 decreases by 4% per luck boost from base 30%, can reach 0
var basePet1Chance = Math.max(0, 30 * Math.pow(0.96, luckBoost));
// Pet2 decreases by 3% per luck boost from base 10%, can reach 0
var basePet2Chance = Math.max(0, 10 * Math.pow(0.97, luckBoost));
// Pet3 and Pet4 always increase with luck boost, never decrease
var basePet3Chance = 1;
var basePet4Chance = 0.05;
// For pets that decrease, don't apply luck multiplier, just use base values
var petChance = basePetChance;
var pet1Chance = basePet1Chance;
var pet2Chance = basePet2Chance;
var pet3Chance = basePet3Chance * luckMultiplier;
var pet4Chance = basePet4Chance * luckMultiplier;
var random = Math.random() * 100; // Convert to percentage
// Create egg result display that always shows
var eggResultDisplay;
if (random < hiddenPetChance) {
// Got hidden pet (rich_water_melon) - increases all hidden pet chances by 500% (5x)
var richWaterMelonCount = storage.richWaterMelonCount || 0;
richWaterMelonCount += 1;
storage.richWaterMelonCount = richWaterMelonCount;
// Show rich_water_melon asset since we got it
eggResultDisplay = game.addChild(LK.getAsset('rich_water_melon', {
anchorX: 0.5,
anchorY: 0.5
}));
} else if (random < hiddenPetChance + pet4Chance) {
// Got pet4
pet4Count += 1;
storage.pet4Count = pet4Count;
// Show achievements_1b_win since we didn't get rich_water_melon
eggResultDisplay = game.addChild(LK.getAsset('achievements_1b_win', {
anchorX: 0.5,
anchorY: 0.5
}));
} else if (random < hiddenPetChance + pet4Chance + pet3Chance) {
// Got pet3
pet3Count += 1;
storage.pet3Count = pet3Count;
// Show achievements_1b_win since we didn't get rich_water_melon
eggResultDisplay = game.addChild(LK.getAsset('achievements_1b_win', {
anchorX: 0.5,
anchorY: 0.5
}));
} else if (random < hiddenPetChance + pet4Chance + pet3Chance + pet2Chance) {
// Got pet2
pet2Count += 1;
storage.pet2Count = pet2Count;
// Show achievements_1b_win since we didn't get rich_water_melon
eggResultDisplay = game.addChild(LK.getAsset('achievements_1b_win', {
anchorX: 0.5,
anchorY: 0.5
}));
} else if (random < hiddenPetChance + pet4Chance + pet3Chance + pet2Chance + pet1Chance) {
// Got pet1
pet1Count += 1;
storage.pet1Count = pet1Count;
// Show achievements_1b_win since we didn't get rich_water_melon
eggResultDisplay = game.addChild(LK.getAsset('achievements_1b_win', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Got pet (remaining chance)
petCount += 1;
storage.petCount = petCount;
// Show achievements_1b_win since we didn't get rich_water_melon
eggResultDisplay = game.addChild(LK.getAsset('achievements_1b_win', {
anchorX: 0.5,
anchorY: 0.5
}));
}
// Position the result display at egg location and make it temporary
eggResultDisplay.x = egg.x;
eggResultDisplay.y = egg.y;
// Remove the display after 2 seconds
LK.setTimeout(function () {
if (eggResultDisplay && eggResultDisplay.parent) {
eggResultDisplay.destroy();
}
}, 2000);
// Recalculate win boost values
petWinBoost = petCount * 0.02;
pet1WinBoost = pet1Count * 0.06;
pet2WinBoost = pet2Count * 0.2;
pet3WinBoost = pet3Count * 1.5;
pet4WinBoost = pet4Count * 60;
totalWinBoost = petWinBoost + pet1WinBoost + pet2WinBoost + pet3WinBoost + pet4WinBoost;
// Recalculate pet muscle boost values
petMuscleBoost = petCount * 0.01;
pet1MuscleBoost = pet1Count * 0.03;
pet2MuscleBoost = pet2Count * 0.1;
pet3MuscleBoost = pet3Count * 0.75;
pet4MuscleBoost = pet4Count * 30;
totalPetMuscleBoost = petMuscleBoost + pet1MuscleBoost + pet2MuscleBoost + pet3MuscleBoost + pet4MuscleBoost;
// Update win boost display
winBoostDisplay.setText('Win Boost: ' + formatNumber(totalWinBoost));
// Update muscle boost display
muscleBoostDisplay.setText('Muscle Boost: ' + formatNumber(muscleBoost + totalPetMuscleBoost));
return;
}
// Check if egg2 was clicked
var egg2Left = egg2.x - 75;
var egg2Right = egg2.x + 75;
var egg2Top = egg2.y - 75;
var egg2Bottom = egg2.y + 75;
if (x >= egg2Left && x <= egg2Right && y >= egg2Top && y <= egg2Bottom && win >= 5000) {
// Deduct 5000 win points
win -= 5000;
storage.win = win;
// Pet chances for egg2 with luck boost effects
var luckMultiplier = 1 + luckBoost * 0.25;
// Apply 5x multiplier to all hidden pet chances if rich water melon is owned
var hiddenPetMultiplier = richWaterMelonCount > 0 ? 5 : 1;
var basePet5Chance = Math.max(0, 50 * Math.pow(0.90, luckBoost)); // Pet5 decreases by 10%
var basePet6Chance = Math.max(0, 20 * Math.pow(0.925, luckBoost)); // Pet6 decreases by 7.5%
var basePet7Chance = 5 * luckMultiplier * hiddenPetMultiplier; // Pet7 increases by 25% and 5x if rich water melon owned
var basePet8Chance = 1 * luckMultiplier * hiddenPetMultiplier; // Pet8 increases by 25% and 5x if rich water melon owned
var basePet9Chance = 0.06 * luckMultiplier * hiddenPetMultiplier; // Pet9 increases by 25% and 5x if rich water melon owned
var basePetSecretChance = 0.0001 * luckMultiplier * hiddenPetMultiplier; // Secret increases by 25% and 5x if rich water melon owned
var random = Math.random() * 100; // Convert to percentage
if (random < basePetSecretChance) {
// Got secret pet
petSecretCount += 1;
storage.petSecretCount = petSecretCount;
} else if (random < basePetSecretChance + basePet9Chance) {
// Got pet9
pet9Count += 1;
storage.pet9Count = pet9Count;
} else if (random < basePetSecretChance + basePet9Chance + basePet8Chance) {
// Got pet8
pet8Count += 1;
storage.pet8Count = pet8Count;
} else if (random < basePetSecretChance + basePet9Chance + basePet8Chance + basePet7Chance) {
// Got pet7
pet7Count += 1;
storage.pet7Count = pet7Count;
} else if (random < basePetSecretChance + basePet9Chance + basePet8Chance + basePet7Chance + basePet6Chance) {
// Got pet6
pet6Count += 1;
storage.pet6Count = pet6Count;
} else {
// Got pet5 (remaining chance)
pet5Count += 1;
storage.pet5Count = pet5Count;
}
// Recalculate win boost values including new pets
petWinBoost = petCount * 0.02;
pet1WinBoost = pet1Count * 0.06;
pet2WinBoost = pet2Count * 0.2;
pet3WinBoost = pet3Count * 1.5;
pet4WinBoost = pet4Count * 60;
pet5WinBoost = pet5Count * 0.1;
pet6WinBoost = pet6Count * 0.4;
pet7WinBoost = pet7Count * 2;
pet8WinBoost = pet8Count * 15;
pet9WinBoost = pet9Count * 100;
petSecretWinBoost = petSecretCount > 0 ? (petWinBoost + pet1WinBoost + pet2WinBoost + pet3WinBoost + pet4WinBoost + pet5WinBoost + pet6WinBoost + pet7WinBoost + pet8WinBoost + pet9WinBoost) * 5 : 0;
totalWinBoost = petWinBoost + pet1WinBoost + pet2WinBoost + pet3WinBoost + pet4WinBoost + pet5WinBoost + pet6WinBoost + pet7WinBoost + pet8WinBoost + pet9WinBoost + petSecretWinBoost;
// Recalculate pet muscle boost values including new pets
petMuscleBoost = petCount * 0.01;
pet1MuscleBoost = pet1Count * 0.03;
pet2MuscleBoost = pet2Count * 0.1;
pet3MuscleBoost = pet3Count * 0.75;
pet4MuscleBoost = pet4Count * 30;
pet5MuscleBoost = pet5Count * 0.07;
pet6MuscleBoost = pet6Count * 0.2;
pet7MuscleBoost = pet7Count * 1.2;
pet8MuscleBoost = pet8Count * 10;
pet9MuscleBoost = pet9Count * 85;
petSecretMuscleBoost = petSecretCount > 0 ? (petMuscleBoost + pet1MuscleBoost + pet2MuscleBoost + pet3MuscleBoost + pet4MuscleBoost + pet5MuscleBoost + pet6MuscleBoost + pet7MuscleBoost + pet8MuscleBoost + pet9MuscleBoost) * 5 : 0;
totalPetMuscleBoost = petMuscleBoost + pet1MuscleBoost + pet2MuscleBoost + pet3MuscleBoost + pet4MuscleBoost + pet5MuscleBoost + pet6MuscleBoost + pet7MuscleBoost + pet8MuscleBoost + pet9MuscleBoost + petSecretMuscleBoost;
// Update win boost display
winBoostDisplay.setText('Win Boost: ' + formatNumber(totalWinBoost));
// Update muscle boost display
muscleBoostDisplay.setText('Muscle Boost: ' + formatNumber(muscleBoost + totalPetMuscleBoost));
return;
}
// Check if admin panel was clicked
var adminPanelBounds = {
left: LK.gui.width + adminPanel.x - adminPanel.width,
right: LK.gui.width + adminPanel.x,
top: LK.gui.height + adminPanel.y - adminPanel.height,
bottom: LK.gui.height + adminPanel.y
};
if (screenX >= adminPanelBounds.left && screenX <= adminPanelBounds.right && screenY >= adminPanelBounds.top && screenY <= adminPanelBounds.bottom) {
// Show code prompt
if (!isCodePromptActive) {
isCodePromptActive = true;
currentInputCode = '';
adminCodePrompt.visible = true;
adminCodePrompt.setText('Enter Code: ' + currentInputCode);
// Show number buttons
for (var showIndex = 0; showIndex < numberButtons.length; showIndex++) {
numberButtons[showIndex].visible = true;
}
}
return;
}
// Handle admin panel interactions when open
if (isAdminOpen) {
// Check if close button was clicked
var adminCloseButtonBounds = {
left: guiCenterX + adminCloseButton.x - 65,
right: guiCenterX + adminCloseButton.x + 65,
top: guiCenterY + adminCloseButton.y - 65,
bottom: guiCenterY + adminCloseButton.y + 65
};
if (screenX >= adminCloseButtonBounds.left && screenX <= adminCloseButtonBounds.right && screenY >= adminCloseButtonBounds.top && screenY <= adminCloseButtonBounds.bottom) {
// Close admin panel
isAdminOpen = false;
isAdminInputMode = false;
adminPanelUI.visible = false;
adminCloseButton.visible = false;
adminMuscleText.visible = false;
adminWinText.visible = false;
adminLuckText.visible = false;
adminEnterButton.visible = false;
adminDeleteButton.visible = false;
adminCodePrompt.visible = false;
// Hide number buttons
for (var hideIndex = 0; hideIndex < numberButtons.length; hideIndex++) {
numberButtons[hideIndex].visible = false;
}
return;
}
// Handle admin input mode
if (isAdminInputMode) {
// Check enter button
var adminEnterBounds = {
left: guiCenterX + adminEnterButton.x - 40,
right: guiCenterX + adminEnterButton.x + 40,
top: guiCenterY + adminEnterButton.y - 40,
bottom: guiCenterY + adminEnterButton.y + 40
};
if (screenX >= adminEnterBounds.left && screenX <= adminEnterBounds.right && screenY >= adminEnterBounds.top && screenY <= adminEnterBounds.bottom) {
// Apply the value
var newValue = parseInt(adminCurrentValue);
if (!isNaN(newValue)) {
if (adminInputType === 'muscle') {
muscle = newValue;
storage.muscle = muscle;
} else if (adminInputType === 'win') {
win = newValue;
storage.win = win;
} else if (adminInputType === 'luck') {
luckBoost = newValue;
storage.luckBoost = luckBoost;
luckBoostDisplay.setText('Luck Boost: ' + formatNumber(luckBoost));
}
}
// Exit input mode
isAdminInputMode = false;
adminCurrentValue = '';
adminCodePrompt.visible = false;
adminEnterButton.visible = false;
adminDeleteButton.visible = false;
// Hide number buttons
for (var hideIndex = 0; hideIndex < numberButtons.length; hideIndex++) {
numberButtons[hideIndex].visible = false;
}
return;
}
// Check delete button
var adminDeleteBounds = {
left: guiCenterX + adminDeleteButton.x - 40,
right: guiCenterX + adminDeleteButton.x + 40,
top: guiCenterY + adminDeleteButton.y - 40,
bottom: guiCenterY + adminDeleteButton.y + 40
};
if (screenX >= adminDeleteBounds.left && screenX <= adminDeleteBounds.right && screenY >= adminDeleteBounds.top && screenY <= adminDeleteBounds.bottom) {
// Remove last character
if (adminCurrentValue.length > 0) {
adminCurrentValue = adminCurrentValue.slice(0, -1);
adminCodePrompt.setText('Enter value: ' + adminCurrentValue);
}
return;
}
// Check number buttons for input
for (var buttonIndex = 0; buttonIndex < numberButtons.length; buttonIndex++) {
var button = numberButtons[buttonIndex];
var buttonBounds = {
left: guiCenterX + button.x - 40,
right: guiCenterX + button.x + 40,
top: guiCenterY + button.y - 40,
bottom: guiCenterY + button.y + 40
};
if (screenX >= buttonBounds.left && screenX <= buttonBounds.right && screenY >= buttonBounds.top && screenY <= buttonBounds.bottom) {
// Add number to value
adminCurrentValue += buttonIndex.toString();
adminCodePrompt.setText('Enter value: ' + adminCurrentValue);
return;
}
}
} else {
// Check if muscle text was clicked
var adminMuscleBounds = {
left: guiCenterX - 150,
right: guiCenterX + 150,
top: guiCenterY + adminMuscleText.y - 30,
bottom: guiCenterY + adminMuscleText.y + 30
};
if (screenX >= adminMuscleBounds.left && screenX <= adminMuscleBounds.right && screenY >= adminMuscleBounds.top && screenY <= adminMuscleBounds.bottom) {
// Enter input mode for muscle
isAdminInputMode = true;
adminInputType = 'muscle';
adminCurrentValue = '';
adminCodePrompt.visible = true;
adminCodePrompt.setText('Enter value: ');
adminEnterButton.visible = true;
adminDeleteButton.visible = true;
// Show number buttons
for (var showIndex = 0; showIndex < numberButtons.length; showIndex++) {
numberButtons[showIndex].visible = true;
}
return;
}
// Check if win text was clicked
var adminWinBounds = {
left: guiCenterX - 150,
right: guiCenterX + 150,
top: guiCenterY + adminWinText.y - 30,
bottom: guiCenterY + adminWinText.y + 30
};
if (screenX >= adminWinBounds.left && screenX <= adminWinBounds.right && screenY >= adminWinBounds.top && screenY <= adminWinBounds.bottom) {
// Enter input mode for win
isAdminInputMode = true;
adminInputType = 'win';
adminCurrentValue = '';
adminCodePrompt.visible = true;
adminCodePrompt.setText('Enter value: ');
adminEnterButton.visible = true;
adminDeleteButton.visible = true;
// Show number buttons
for (var showIndex = 0; showIndex < numberButtons.length; showIndex++) {
numberButtons[showIndex].visible = true;
}
return;
}
// Check if luck boost text was clicked
var adminLuckBounds = {
left: guiCenterX - 150,
right: guiCenterX + 150,
top: guiCenterY + adminLuckText.y - 30,
bottom: guiCenterY + adminLuckText.y + 30
};
if (screenX >= adminLuckBounds.left && screenX <= adminLuckBounds.right && screenY >= adminLuckBounds.top && screenY <= adminLuckBounds.bottom) {
// Enter input mode for luck boost
isAdminInputMode = true;
adminInputType = 'luck';
adminCurrentValue = '';
adminCodePrompt.visible = true;
adminCodePrompt.setText('Enter value: ');
adminEnterButton.visible = true;
adminDeleteButton.visible = true;
// Show number buttons
for (var showIndex = 0; showIndex < numberButtons.length; showIndex++) {
numberButtons[showIndex].visible = true;
}
return;
}
}
return;
}
// Handle code prompt interactions
if (isCodePromptActive) {
// Check which number button was clicked
for (var buttonIndex = 0; buttonIndex < numberButtons.length; buttonIndex++) {
var button = numberButtons[buttonIndex];
var buttonBounds = {
left: guiCenterX + button.x - 40,
right: guiCenterX + button.x + 40,
top: guiCenterY + button.y - 40,
bottom: guiCenterY + button.y + 40
};
if (screenX >= buttonBounds.left && screenX <= buttonBounds.right && screenY >= buttonBounds.top && screenY <= buttonBounds.bottom) {
// Button clicked - add number to code
currentInputCode += buttonIndex.toString();
adminCodePrompt.setText('Enter Code: ' + currentInputCode);
if (currentInputCode.length >= 6) {
// Check if code matches
if (currentInputCode === adminCode) {
// Correct code - open admin panel
isCodePromptActive = false;
isAdminOpen = true;
adminCodePrompt.visible = false;
// Hide number buttons
for (var hideIndex = 0; hideIndex < numberButtons.length; hideIndex++) {
numberButtons[hideIndex].visible = false;
}
adminPanelUI.visible = true;
adminCloseButton.visible = true;
adminMuscleText.visible = true;
adminWinText.visible = true;
adminLuckText.visible = true;
// Update display values
adminMuscleText.setText('Muscle');
adminWinText.setText('Win');
adminLuckText.setText('Luck Boost');
} else {
// Wrong code - reset
isCodePromptActive = false;
adminCodePrompt.visible = false;
// Hide number buttons
for (var hideIndex = 0; hideIndex < numberButtons.length; hideIndex++) {
numberButtons[hideIndex].visible = false;
}
currentInputCode = '';
}
}
return;
}
}
return;
}
// Check if inventory was clicked (convert screen coordinates to GUI coordinates)
var inventoryBounds = {
left: LK.gui.width + inventory.x - inventory.width * 0.15,
right: LK.gui.width + inventory.x,
top: LK.gui.height + inventory.y - inventory.height * 0.15,
bottom: LK.gui.height + inventory.y
};
if (screenX >= inventoryBounds.left && screenX <= inventoryBounds.right && screenY >= inventoryBounds.top && screenY <= inventoryBounds.bottom) {
// Open inventory (don't toggle, only open)
if (!isInventoryOpen) {
isInventoryOpen = true;
currentInventoryPage = 1; // Reset to first page when opening
inInventoryImage.visible = true;
close1Button.visible = true;
nextPageButton.visible = true;
prevPageButton.visible = true;
pageNumberDisplay.visible = true;
pageNumberDisplay.setText('Page 1/2');
// Calculate dynamic chances with luck boost
var luckMultiplier = 1 + luckBoost * 0.25;
// Pet (first pet) decreases by 5% per luck boost from base 70%, can reach 0
var basePetChance = Math.max(0, 70 * Math.pow(0.95, luckBoost));
// Pet1 decreases by 4% per luck boost from base 30%, can reach 0
var basePet1Chance = Math.max(0, 30 * Math.pow(0.96, luckBoost));
// Pet2 decreases by 3% per luck boost from base 10%, can reach 0
var basePet2Chance = Math.max(0, 10 * Math.pow(0.97, luckBoost));
// Pet3 and Pet4 always increase with luck boost, never decrease
var basePet3Chance = 1;
var basePet4Chance = 0.05;
// For pets that decrease, don't apply luck multiplier, just use base values
var finalPetChance = basePetChance;
var finalPet1Chance = basePet1Chance;
var finalPet2Chance = basePet2Chance;
var finalPet3Chance = basePet3Chance * luckMultiplier;
var finalPet4Chance = basePet4Chance * luckMultiplier;
// Always show all pets on page 1 with correct assets and all text
// Pet (first pet) - always show with text
if (petCount > 0) {
// Change to actual pet asset since we have at least one
petDisplay.removeChildren();
petDisplay.addChild(LK.getAsset('pet', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Use _D asset since we don't have any
petDisplay.removeChildren();
petDisplay.addChild(LK.getAsset('pet_D', {
anchorX: 0.5,
anchorY: 0.5
}));
}
petDisplay.visible = true;
petCountText.visible = true;
petCountText.setText(formatNumber(petCount) + 'x');
petChanceText.visible = true;
petChanceText.setText(formatNumber(finalPetChance) + '%');
petBoostText.visible = true;
petBoostText.setText('Win boost = ' + formatNumber(petCount * 0.02));
petMuscleBoostText.visible = true;
petMuscleBoostText.setText('Muscle boost = ' + formatNumber(petCount * 0.01));
// Pet1 - always show with text
if (pet1Count > 0) {
// Change to actual pet1 asset since we have at least one
pet1Display.removeChildren();
pet1Display.addChild(LK.getAsset('pet1', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Use _D asset since we don't have any
pet1Display.removeChildren();
pet1Display.addChild(LK.getAsset('pet1_D', {
anchorX: 0.5,
anchorY: 0.5
}));
}
pet1Display.visible = true;
pet1CountText.visible = true;
pet1CountText.setText(formatNumber(pet1Count) + 'x');
pet1ChanceText.visible = true;
pet1ChanceText.setText(formatNumber(finalPet1Chance) + '%');
pet1BoostText.visible = true;
pet1BoostText.setText('Win boost = ' + formatNumber(pet1Count * 0.06));
pet1MuscleBoostText.visible = true;
pet1MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet1Count * 0.03));
// Pet2 - always show with text
if (pet2Count > 0) {
// Change to actual pet2 asset since we have at least one
pet2Display.removeChildren();
pet2Display.addChild(LK.getAsset('pet2', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Use _D asset since we don't have any
pet2Display.removeChildren();
pet2Display.addChild(LK.getAsset('pet2_D', {
anchorX: 0.5,
anchorY: 0.5
}));
}
pet2Display.visible = true;
pet2CountText.visible = true;
pet2CountText.setText(formatNumber(pet2Count) + 'x');
pet2ChanceText.visible = true;
pet2ChanceText.setText(formatNumber(finalPet2Chance) + '%');
pet2BoostText.visible = true;
pet2BoostText.setText('Win boost = ' + formatNumber(pet2Count * 0.2));
pet2MuscleBoostText.visible = true;
pet2MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet2Count * 0.1));
// Pet3 - always show with text
if (pet3Count > 0) {
// Change to actual pet3 asset since we have at least one
pet3Display.removeChildren();
pet3Display.addChild(LK.getAsset('pet3', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Use _D asset since we don't have any
pet3Display.removeChildren();
pet3Display.addChild(LK.getAsset('pet3_D', {
anchorX: 0.5,
anchorY: 0.5
}));
}
pet3Display.visible = true;
pet3CountText.visible = true;
pet3CountText.setText(formatNumber(pet3Count) + 'x');
pet3ChanceText.visible = true;
pet3ChanceText.setText(formatNumber(finalPet3Chance) + '%');
pet3BoostText.visible = true;
pet3BoostText.setText('Win boost = ' + formatNumber(pet3Count * 1.5));
pet3MuscleBoostText.visible = true;
pet3MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet3Count * 0.75));
// Pet4 - always show with text
if (pet4Count > 0) {
// Change to actual pet4 asset since we have at least one
pet4Display.removeChildren();
pet4Display.addChild(LK.getAsset('pet4', {
anchorX: 0.5,
anchorY: 0.5
}));
} else {
// Use _D asset since we don't have any
pet4Display.removeChildren();
pet4Display.addChild(LK.getAsset('pet4_D', {
anchorX: 0.5,
anchorY: 0.5
}));
}
pet4Display.visible = true;
pet4CountText.visible = true;
pet4CountText.setText(formatNumber(pet4Count) + 'x');
pet4ChanceText.visible = true;
pet4ChanceText.setText(formatNumber(finalPet4Chance) + '%');
pet4BoostText.visible = true;
pet4BoostText.setText('Win boost = ' + formatNumber(pet4Count * 60));
pet4MuscleBoostText.visible = true;
pet4MuscleBoostText.setText('Muscle boost = ' + formatNumber(pet4Count * 30));
// Always show rich_water_melon or achievements_1b_win with all text
var hiddenPetMultiplier = 1 + luckBoost * 0.25;
var hiddenPetChance = 0.000075 * hiddenPetMultiplier;
if (richWaterMelonCount > 0) {
// Show rich_water_melon since we have it
richWaterMelonDisplay.visible = true;
richWaterMelonCountText.visible = true;
richWaterMelonCountText.setText(formatNumber(richWaterMelonCount) + 'x');
richWaterMelonChanceText.visible = true;
richWaterMelonChanceText.setText(hiddenPetChance.toFixed(6) + '%');
richWaterMelonBoostText.visible = true;
} else {
// Show achievements_1b_win as placeholder
achievementsDisplay.visible = true;
achievementsCountText.visible = true;
achievementsCountText.setText(hiddenPetChance.toFixed(6) + '%');
achievementsInfoText.visible = true;
achievementsInfoText.setText('All secret pets 5x');
}
}
return;
}
// Enemy click delay tracking
var enemyLastClickTime = 0;
var enemy1LastClickTime = 0;
var enemy2LastClickTime = 0;
var enemy3LastClickTime = 0;
// Check if enemy was clicked and character has muscle >= 10
var enemyLeft = enemy.x - 100;
var enemyRight = enemy.x + 100;
var enemyTop = enemy.y - 100;
var enemyBottom = enemy.y + 100;
if (x >= enemyLeft && x <= enemyRight && y >= enemyTop && y <= enemyBottom && muscle >= 10) {
var currentTime = Date.now();
// Check if 0.5 seconds have passed since last click
if (currentTime - enemyLastClickTime >= 500) {
enemyLastClickTime = currentTime;
// Wait 0.5 seconds then increment win
LK.setTimeout(function () {
win = formatWin(win + 1 + totalWinBoost);
storage.win = win;
}, 500); // 0.5 seconds = 500ms
}
return;
}
// Check if second enemy was clicked and character has muscle >= 100
var enemy1Left = enemy1.x - 100;
var enemy1Right = enemy1.x + 100;
var enemy1Top = enemy1.y - 100;
var enemy1Bottom = enemy1.y + 100;
if (x >= enemy1Left && x <= enemy1Right && y >= enemy1Top && y <= enemy1Bottom && muscle >= 100) {
var currentTime = Date.now();
// Check if 0.5 seconds have passed since last click
if (currentTime - enemy1LastClickTime >= 500) {
enemy1LastClickTime = currentTime;
// Wait 0.5 seconds then increment win by 15
LK.setTimeout(function () {
win = formatWin(win + 15 + totalWinBoost);
storage.win = win;
}, 500); // 0.5 seconds = 500ms
}
return;
}
// Check if third enemy was clicked and character has muscle >= 5000
var enemy2Left = enemy2.x - 100;
var enemy2Right = enemy2.x + 100;
var enemy2Top = enemy2.y - 100;
var enemy2Bottom = enemy2.y + 100;
if (x >= enemy2Left && x <= enemy2Right && y >= enemy2Top && y <= enemy2Bottom && muscle >= 5000) {
var currentTime = Date.now();
// Check if 0.5 seconds have passed since last click
if (currentTime - enemy2LastClickTime >= 500) {
enemy2LastClickTime = currentTime;
// Wait 0.5 seconds then increment win by 1000
LK.setTimeout(function () {
win = formatWin(win + 1000 + totalWinBoost);
storage.win = win;
}, 500); // 0.5 seconds = 500ms
}
return;
}
// Check if fourth enemy was clicked and character has muscle >= 50000
var enemy3Left = enemy3.x - 100;
var enemy3Right = enemy3.x + 100;
var enemy3Top = enemy3.y - 100;
var enemy3Bottom = enemy3.y + 100;
if (x >= enemy3Left && x <= enemy3Right && y >= enemy3Top && y <= enemy3Bottom && muscle >= 50000) {
var currentTime = Date.now();
// Check if 0.5 seconds have passed since last click
if (currentTime - enemy3LastClickTime >= 500) {
enemy3LastClickTime = currentTime;
// Wait 0.5 seconds then increment win by 10000
LK.setTimeout(function () {
win = formatWin(win + 10000 + totalWinBoost);
storage.win = win;
}, 500); // 0.5 seconds = 500ms
}
return;
}
// Check if weight lifting rectangle was clicked
var rectLeft = weightLiftingRect.x - 175;
var rectRight = weightLiftingRect.x + 175;
var rectTop = weightLiftingRect.y - 70;
var rectBottom = weightLiftingRect.y + 70;
if (x >= rectLeft && x <= rectRight && y >= rectTop && y <= rectBottom && !isMovingToWeights && !isWaitingAtWeights) {
// Move character to weight lifting area
isMovingToWeights = true;
character.setVelocity(0, 0); // Stop current movement
tween(character, {
x: weightLiftingRect.x,
y: weightLiftingRect.y + 350
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
isMovingToWeights = false;
isWaitingAtWeights = true;
// Wait 1 second then increase muscle
LK.setTimeout(function () {
muscle = Math.round((muscle + 1 + muscleBoost + totalPetMuscleBoost) * 10) / 10;
storage.muscle = muscle;
isWaitingAtWeights = false;
}, 250);
}
});
return;
}
// Check if second weight lifting rectangle was clicked and character has muscle >= 10000
var rect1Left = weightLiftingRect1.x - 175;
var rect1Right = weightLiftingRect1.x + 175;
var rect1Top = weightLiftingRect1.y - 70;
var rect1Bottom = weightLiftingRect1.y + 70;
if (x >= rect1Left && x <= rect1Right && y >= rect1Top && y <= rect1Bottom && muscle >= 10000 && !isMovingToWeights && !isWaitingAtWeights) {
// Move character to second weight lifting area
isMovingToWeights = true;
character.setVelocity(0, 0); // Stop current movement
tween(character, {
x: weightLiftingRect1.x,
y: weightLiftingRect1.y + 350
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
isMovingToWeights = false;
isWaitingAtWeights = true;
// Wait 1 second then increase muscle by 300
LK.setTimeout(function () {
muscle = Math.round((muscle + 300 + muscleBoost + totalPetMuscleBoost) * 10) / 10;
storage.muscle = muscle;
isWaitingAtWeights = false;
}, 250);
}
});
return;
}
// Check if third weight lifting rectangle was clicked and character has muscle >= 100000
var rect2Left = weightLiftingRect2.x - 175;
var rect2Right = weightLiftingRect2.x + 175;
var rect2Top = weightLiftingRect2.y - 70;
var rect2Bottom = weightLiftingRect2.y + 70;
if (x >= rect2Left && x <= rect2Right && y >= rect2Top && y <= rect2Bottom && muscle >= 100000 && !isMovingToWeights && !isWaitingAtWeights) {
// Move character to third weight lifting area
isMovingToWeights = true;
character.setVelocity(0, 0); // Stop current movement
tween(character, {
x: weightLiftingRect2.x,
y: weightLiftingRect2.y + 350
}, {
duration: 500,
easing: tween.easeInOut,
onFinish: function onFinish() {
isMovingToWeights = false;
isWaitingAtWeights = true;
// Wait 1 second then increase muscle by 2000
LK.setTimeout(function () {
muscle = Math.round((muscle + 2000 + muscleBoost + totalPetMuscleBoost) * 10) / 10;
storage.muscle = muscle;
isWaitingAtWeights = false;
}, 250);
}
});
return;
}
// Show joystick in expanded area (left side to middle, expanded Y area)
if (x > 0 && x < 1200 && y > 2082) {
joystick.show(x, y);
isDragging = true;
var input = joystick.updateHandle(x, y);
if (input) {
character.setVelocity(input.x * input.magnitude, input.y * input.magnitude);
}
}
};
game.move = function (x, y, obj) {
if (isDragging && joystick.isActive && !isMovingToWeights && !isWaitingAtWeights) {
var input = joystick.updateHandle(x, y);
if (input) {
character.setVelocity(input.x * input.magnitude, input.y * input.magnitude);
}
}
};
game.up = function (x, y, obj) {
if (isDragging && !isMovingToWeights && !isWaitingAtWeights) {
isDragging = false;
joystick.hide();
character.setVelocity(0, 0);
}
};
game.update = function () {
// Character update is handled automatically by its update method
};
2 d az kaslı insan görseli oluştur. In-Game asset. 2d. High contrast. No shadows 1 tane ten renginde
Shop 2 d pixel. In-Game asset. 2d. High contrast. No shadows
Pixel kaslı kol 2d kuş bakışı. In-Game asset. 2d. High contrast. No shadows
Etrafı tablo gibi olan içi gri etrafında kahverengi dışı. In-Game asset. 2d. High contrast. No shadows
1 tane az kaslı yeşil slime yap çok az kası olsun nötr surat olsun. In-Game asset. 2d. High contrast. No shadows ayakları elleri kafası var
Kırmızı kasları ve damarları gözüken slime ama çok değil az gözüken damarları. In-Game asset. 2d. High contrast. No shadows elleri ayakları var kırmızı sinirli insan boyunda kısa değil
Bana sarı kaslı bir slime yap elleri kolları ayakları var kasları kolayca belli oluyo nötr. In-Game asset. 2d. High contrast. No shadows
İnsan boyunda elleri kolları ayakları olan sinirli kaslı damarlı egzotik cyan renginde slime yap. In-Game asset. 2d. High contrast. No shadows
Pixel oyun tarzı köpek balığı peti oluştur 2 d. In-Game asset. 2d. High contrast. No shadows
Ekranı 4 e böl ve 4 tane pet 2 d yap pixel biri papağan biri kaplan biri yılan biri de kemikten oluşan gizemli bir pet siyah kırmızı tarzı renkler kullan. In-Game asset. 2d. High contrast. No shadows
Elleri ayakları kolları olan gökkuşağı renklerinde yüzsüz çok fazla kaslı damarlı slime yap. Tatlı In-Game asset. 2d. High contrast. No shadows