/**** * Plugins ****/ var storage = LK.import("@upit/storage.v1"); var tween = LK.import("@upit/tween.v1"); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a2e }); /**** * Game Code ****/ var currentTab = storage.currentTab || 'infinity'; var clickCount = storage.clickCount || 0; var developerMode = storage.developerMode || false; var developerTabUnlocked = storage.developerTabUnlocked || false; var inputCode = ''; var isInputting = false; // Create weird logo in top right corner var weirdLogo = game.addChild(LK.getAsset('weirdLogo', { anchorX: 0.5, anchorY: 0.5, width: 120, height: 120 })); weirdLogo.x = 2048 - 150; weirdLogo.y = 150; weirdLogo.tint = 0x420069; // Make the logo spin continuously var logoSpinTimer = LK.setInterval(function () { weirdLogo.rotation += 0.1; // Random color changes if (Math.random() < 0.1) { weirdLogo.tint = Math.random() * 0xffffff; } }, 50); // Developer mode UI container var developerContainer = new Container(); game.addChild(developerContainer); // Code input overlay var codeInputContainer = new Container(); game.addChild(codeInputContainer); // Store cards definition (needed before equippedCards initialization) var storeCards = [{ name: 'Critical Hit', description: '15% chance for critical hit (2x damage)', price: 100 }, { name: 'Auto Clicker', description: 'One click per second automatically', price: 200 }, { name: 'Double Coins', description: 'Earn 2x coins from clicks', price: 300 }, { name: 'Lucky Strike', description: '10% chance for 5x click value', price: 250 }]; // Cards and store variables var cards = storage.cards || []; // Convert stored owned cards back to objects var storedOwnedCards = storage.ownedCards || []; var ownedCards = []; for (var i = 0; i < storedOwnedCards.length; i++) { // Find the card object from storeCards array for (var j = 0; j < storeCards.length; j++) { if (storeCards[j].name === storedOwnedCards[i]) { ownedCards.push(storeCards[j]); break; } } } // Convert stored equipped cards back to objects var storedEquippedCards = storage.equippedCards || []; var equippedCards = []; for (var i = 0; i < storedEquippedCards.length; i++) { if (storedEquippedCards[i]) { // Find the card object from storeCards array for (var j = 0; j < storeCards.length; j++) { if (storeCards[j].name === storedEquippedCards[i]) { equippedCards[i] = storeCards[j]; break; } } } else { equippedCards[i] = null; } } var cardSlots = storage.cardSlots || 1; var coins = storage.coins || 0; var currentTab = storage.currentTab || 'infinity'; // Create tab button shadows var infinityTabShadow = game.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 500, height: 160 })); infinityTabShadow.tint = 0x000000; infinityTabShadow.alpha = 0.3; infinityTabShadow.x = 2048 / 2 - 400 + 6; infinityTabShadow.y = 200 + 6; var cardsTabShadow = game.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 500, height: 160 })); cardsTabShadow.tint = 0x000000; cardsTabShadow.alpha = 0.3; cardsTabShadow.x = 2048 / 2 + 400 + 6; cardsTabShadow.y = 200 + 6; // Developer tab shadow (initially hidden) var developerTabShadow = game.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 160 })); developerTabShadow.tint = 0x000000; developerTabShadow.alpha = 0.3; developerTabShadow.x = 2048 / 2 + 6; developerTabShadow.y = 350 + 6; developerTabShadow.visible = false; // Create tab buttons var infinityTab = game.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 500, height: 160 })); infinityTab.x = 2048 / 2 - 400; infinityTab.y = 200; var cardsTab = game.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 500, height: 160 })); cardsTab.x = 2048 / 2 + 400; cardsTab.y = 200; // Developer tab button (initially hidden) var developerTab = game.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 160 })); developerTab.x = 2048 / 2; developerTab.y = 350; developerTab.tint = 0x420069; developerTab.visible = false; // Tab text var infinityTabText = new Text2('INFINITY', { size: 60, fill: 0xffffff }); infinityTabText.anchor.set(0.5, 0.5); infinityTabText.x = infinityTab.x; infinityTabText.y = infinityTab.y; game.addChild(infinityTabText); var cardsTabText = new Text2('CARDS', { size: 60, fill: 0xffffff }); cardsTabText.anchor.set(0.5, 0.5); cardsTabText.x = cardsTab.x; cardsTabText.y = cardsTab.y; game.addChild(cardsTabText); // Developer tab text (initially hidden) var developerTabText = new Text2('DEVELOPER', { size: 50, fill: 0xffffff }); developerTabText.anchor.set(0.5, 0.5); developerTabText.x = developerTab.x; developerTabText.y = developerTab.y; developerTabText.visible = false; game.addChild(developerTabText); // Create button shadow var buttonShadow = game.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5 })); buttonShadow.tint = 0x000000; buttonShadow.alpha = 0.3; buttonShadow.x = 2048 / 2 + 8; buttonShadow.y = 2732 / 2 - 100 + 8; // Create the main button var button = game.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5 })); // Position button in center of screen button.x = 2048 / 2; button.y = 2732 / 2 - 100; // Array of random button texts var buttonTexts = ['CLICK ME!', 'TAP HERE!', 'PRESS ME!', 'HIT IT!', 'CLICK NOW!', 'TAP AWAY!', 'PUSH IT!', 'GO AHEAD!', 'CLICK THIS!', 'TAP TAP!']; // Create button text with random initial text var buttonText = new Text2(buttonTexts[Math.floor(Math.random() * buttonTexts.length)], { size: 60, fill: 0xffffff }); buttonText.anchor.set(0.5, 0.5); buttonText.x = button.x; buttonText.y = button.y; game.addChild(buttonText); // Create counter text var counterText = new Text2('Clicks: 0', { size: 160, fill: 0x50fa7b }); counterText.anchor.set(0.5, 0.5); counterText.x = 2048 / 2; counterText.y = 2732 / 2 + 300; game.addChild(counterText); // Create coins display var coinsText = new Text2('Coins: ' + coins, { size: 100, fill: 0xff79c6 }); coinsText.anchor.set(0.5, 0.5); coinsText.x = 2048 / 2 - 300; coinsText.y = 700; game.addChild(coinsText); // Create buy slot button next to coin counter var buySlotButtonMain = game.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 120 })); buySlotButtonMain.x = 2048 / 2 + 100; buySlotButtonMain.y = 700; buySlotButtonMain.tint = 0x50fa7b; buySlotButtonMain.visible = false; var buySlotTextMain = new Text2('Buy Slot (50)', { size: 50, fill: 0xffffff }); buySlotTextMain.anchor.set(0.5, 0.5); buySlotTextMain.x = buySlotButtonMain.x; buySlotTextMain.y = buySlotButtonMain.y; buySlotTextMain.visible = false; game.addChild(buySlotTextMain); // Create sell slot button next to buy slot button var sellSlotButtonMain = game.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 400, height: 120 })); sellSlotButtonMain.x = 2048 / 2 + 500; sellSlotButtonMain.y = 700; sellSlotButtonMain.tint = 0xff5555; sellSlotButtonMain.visible = false; var sellSlotTextMain = new Text2('Sell Slot (25)', { size: 50, fill: 0xffffff }); sellSlotTextMain.anchor.set(0.5, 0.5); sellSlotTextMain.x = sellSlotButtonMain.x; sellSlotTextMain.y = sellSlotButtonMain.y; sellSlotTextMain.visible = false; game.addChild(sellSlotTextMain); sellSlotButtonMain.down = function () { if (cardSlots > 1) { // Remove card from the last slot if it exists if (equippedCards[cardSlots - 1]) { equippedCards[cardSlots - 1] = null; } // Remove the slot cardSlots--; coins += 25; storage.coins = coins; storage.cardSlots = cardSlots; // Update equipped cards storage var equippedCardNames = []; for (var i = 0; i < equippedCards.length; i++) { equippedCardNames[i] = equippedCards[i] ? equippedCards[i].name : null; } storage.equippedCards = equippedCardNames; coinsText.setText('Coins: ' + coins); updateCardSlots(); updateBuySlotButton(); } }; buySlotButtonMain.down = function () { if (coins >= 50 && cardSlots < 9) { coins -= 50; cardSlots++; storage.coins = coins; storage.cardSlots = cardSlots; coinsText.setText('Coins: ' + coins); updateCardSlots(); updateBuySlotButton(); } }; function updateBuySlotButton() { if (currentTab === 'cards') { // Show buy button only if less than 9 slots if (cardSlots < 9) { buySlotButtonMain.visible = true; buySlotTextMain.visible = true; } else { buySlotButtonMain.visible = false; buySlotTextMain.visible = false; } // Show sell button only if more than 1 slot if (cardSlots > 1) { sellSlotButtonMain.visible = true; sellSlotTextMain.visible = true; } else { sellSlotButtonMain.visible = false; sellSlotTextMain.visible = false; } } else { buySlotButtonMain.visible = false; buySlotTextMain.visible = false; sellSlotButtonMain.visible = false; sellSlotTextMain.visible = false; } } // Cards menu container var cardsMenuContainer = new Container(); game.addChild(cardsMenuContainer); // Create store menu button shadow var storeMenuButtonShadow = cardsMenuContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 800, height: 200 })); storeMenuButtonShadow.tint = 0x000000; storeMenuButtonShadow.alpha = 0.3; storeMenuButtonShadow.x = 2048 / 2 + 8; storeMenuButtonShadow.y = 400 + 8; // Create store menu button only var storeMenuButton = cardsMenuContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 800, height: 200 })); storeMenuButton.x = 2048 / 2; storeMenuButton.y = 400; var storeMenuText = new Text2('STORE', { size: 80, fill: 0xffffff }); storeMenuText.anchor.set(0.5, 0.5); storeMenuText.x = storeMenuButton.x; storeMenuText.y = storeMenuButton.y; cardsMenuContainer.addChild(storeMenuText); // Cards tab UI elements var cardSlotsContainer = new Container(); game.addChild(cardSlotsContainer); var cardSlotButtons = []; var cardSlotTexts = []; // Scrolling variables for cards tab var cardsScrollY = 0; var cardsScrolling = false; var cardsStartY = 0; var cardsLastY = 0; var cardsHolding = false; var cardsHoldTimer = null; var cardsScrollContainer = new Container(); cardSlotsContainer.addChild(cardsScrollContainer); // Store tab UI elements var storeContainer = new Container(); game.addChild(storeContainer); // Function to show developer mode function showDeveloperMode() { developerContainer.removeChildren(); developerContainer.visible = true; // Background overlay var devOverlay = developerContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 2048, height: 2732 })); devOverlay.tint = 0x000000; devOverlay.alpha = 0.8; devOverlay.x = 2048 / 2; devOverlay.y = 2732 / 2; // Developer panel var devPanel = developerContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 1800, height: 2200 })); devPanel.tint = 0x1a1a2e; devPanel.x = 2048 / 2; devPanel.y = 2732 / 2; // Title var devTitle = new Text2('DEVELOPER MODE', { size: 100, fill: 0x42069 }); devTitle.anchor.set(0.5, 0.5); devTitle.x = devPanel.x; devTitle.y = devPanel.y - 900; developerContainer.addChild(devTitle); // Close button var closeDevButton = developerContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 200, height: 100 })); closeDevButton.x = devPanel.x + 800; closeDevButton.y = devPanel.y - 900; closeDevButton.tint = 0xff5555; var closeDevText = new Text2('X', { size: 60, fill: 0xffffff }); closeDevText.anchor.set(0.5, 0.5); closeDevText.x = closeDevButton.x; closeDevText.y = closeDevButton.y; developerContainer.addChild(closeDevText); closeDevButton.down = function () { developerContainer.visible = false; }; // Add coins button var addCoinsButton = developerContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 800, height: 200 })); addCoinsButton.x = devPanel.x; addCoinsButton.y = devPanel.y - 600; addCoinsButton.tint = 0x50fa7b; var addCoinsText = new Text2('Add 1000 Coins', { size: 80, fill: 0xffffff }); addCoinsText.anchor.set(0.5, 0.5); addCoinsText.x = addCoinsButton.x; addCoinsText.y = addCoinsButton.y; developerContainer.addChild(addCoinsText); addCoinsButton.down = function () { coins += 1000; storage.coins = coins; coinsText.setText('Coins: ' + coins); LK.effects.flashScreen(0x50fa7b, 300); }; // Max clicks button var maxClicksButton = developerContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 800, height: 200 })); maxClicksButton.x = devPanel.x; maxClicksButton.y = devPanel.y - 300; maxClicksButton.tint = 0x8b5cf6; var maxClicksText = new Text2('Add 10000 Clicks', { size: 80, fill: 0xffffff }); maxClicksText.anchor.set(0.5, 0.5); maxClicksText.x = maxClicksButton.x; maxClicksText.y = maxClicksButton.y; developerContainer.addChild(maxClicksText); maxClicksButton.down = function () { clickCount += 10000; storage.clickCount = clickCount; counterText.setText('Clicks: ' + clickCount); LK.effects.flashScreen(0x8b5cf6, 300); }; // Unlock all cards button var unlockCardsButton = developerContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 800, height: 200 })); unlockCardsButton.x = devPanel.x; unlockCardsButton.y = devPanel.y; unlockCardsButton.tint = 0xff79c6; var unlockCardsText = new Text2('Unlock All Cards', { size: 80, fill: 0xffffff }); unlockCardsText.anchor.set(0.5, 0.5); unlockCardsText.x = unlockCardsButton.x; unlockCardsText.y = unlockCardsButton.y; developerContainer.addChild(unlockCardsText); unlockCardsButton.down = function () { for (var i = 0; i < storeCards.length; i++) { var alreadyOwned = false; for (var j = 0; j < ownedCards.length; j++) { if (ownedCards[j].name === storeCards[i].name) { alreadyOwned = true; break; } } if (!alreadyOwned) { ownedCards.push(storeCards[i]); } } // Convert ownedCards to storage-compatible format var ownedCardNames = []; for (var k = 0; k < ownedCards.length; k++) { ownedCardNames.push(ownedCards[k].name); } storage.ownedCards = ownedCardNames; LK.effects.flashScreen(0xff79c6, 300); }; // Max card slots button var maxSlotsButton = developerContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 800, height: 200 })); maxSlotsButton.x = devPanel.x; maxSlotsButton.y = devPanel.y + 300; maxSlotsButton.tint = 0xffb86c; var maxSlotsText = new Text2('Max Out Card Slots (9)', { size: 80, fill: 0xffffff }); maxSlotsText.anchor.set(0.5, 0.5); maxSlotsText.x = maxSlotsButton.x; maxSlotsText.y = maxSlotsButton.y; developerContainer.addChild(maxSlotsText); maxSlotsButton.down = function () { cardSlots = 9; storage.cardSlots = cardSlots; updateCardSlots(); updateBuySlotButton(); LK.effects.flashScreen(0xffb86c, 300); }; // Reset game button var resetButton = developerContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 800, height: 200 })); resetButton.x = devPanel.x; resetButton.y = devPanel.y + 600; resetButton.tint = 0xff0000; var resetText = new Text2('Reset Game', { size: 80, fill: 0xffffff }); resetText.anchor.set(0.5, 0.5); resetText.x = resetButton.x; resetText.y = resetButton.y; developerContainer.addChild(resetText); resetButton.down = function () { // Clear all storage data storage.clickCount = 0; storage.coins = 0; storage.cards = []; storage.ownedCards = []; storage.equippedCards = []; storage.cardSlots = 1; storage.currentTab = 'infinity'; storage.developerMode = false; storage.developerTabUnlocked = false; // Flash red and show game over to restart LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); }; // Lock developer mode button var lockDevButton = developerContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 800, height: 200 })); lockDevButton.x = devPanel.x; lockDevButton.y = devPanel.y + 900; lockDevButton.tint = 0xff5555; var lockDevText = new Text2('Lock Developer Mode', { size: 80, fill: 0xffffff }); lockDevText.anchor.set(0.5, 0.5); lockDevText.x = lockDevButton.x; lockDevText.y = lockDevButton.y; developerContainer.addChild(lockDevText); lockDevButton.down = function () { developerMode = false; developerTabUnlocked = false; storage.developerMode = developerMode; storage.developerTabUnlocked = developerTabUnlocked; currentTab = 'infinity'; storage.currentTab = currentTab; updateTabDisplay(); developerContainer.visible = false; LK.effects.flashScreen(0xff5555, 300); }; } // Function to show code input function showCodeInput() { codeInputContainer.removeChildren(); codeInputContainer.visible = true; isInputting = true; inputCode = ''; // Background overlay var inputOverlay = codeInputContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 2048, height: 2732 })); inputOverlay.tint = 0x000000; inputOverlay.alpha = 0.7; inputOverlay.x = 2048 / 2; inputOverlay.y = 2732 / 2; // Input panel var inputPanel = codeInputContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 1200, height: 800 })); inputPanel.tint = 0x2d3748; inputPanel.x = 2048 / 2; inputPanel.y = 2732 / 2; // Title var inputTitle = new Text2('Enter Developer Code', { size: 80, fill: 0xffffff }); inputTitle.anchor.set(0.5, 0.5); inputTitle.x = inputPanel.x; inputTitle.y = inputPanel.y - 250; codeInputContainer.addChild(inputTitle); // Code display var codeDisplay = new Text2('*****', { size: 120, fill: 0x42069 }); codeDisplay.anchor.set(0.5, 0.5); codeDisplay.x = inputPanel.x; codeDisplay.y = inputPanel.y - 50; codeInputContainer.addChild(codeDisplay); // Number buttons var numberButtons = []; for (var i = 0; i < 10; i++) { var numButton = codeInputContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 120, height: 120 })); numButton.x = inputPanel.x - 250 + i % 5 * 125; numButton.y = inputPanel.y + 150 + Math.floor(i / 5) * 140; numButton.tint = 0x4a90e2; var numText = new Text2(i.toString(), { size: 60, fill: 0xffffff }); numText.anchor.set(0.5, 0.5); numText.x = numButton.x; numText.y = numButton.y; codeInputContainer.addChild(numText); numButton.digit = i; numButton.down = function () { if (inputCode.length < 5) { inputCode += this.digit.toString(); var displayCode = ''; for (var j = 0; j < inputCode.length; j++) { displayCode += inputCode[j]; } for (var k = inputCode.length; k < 5; k++) { displayCode += '*'; } codeDisplay.setText(displayCode); if (inputCode.length === 5) { LK.setTimeout(function () { if (inputCode === '96469') { developerMode = true; developerTabUnlocked = true; storage.developerMode = developerMode; storage.developerTabUnlocked = developerTabUnlocked; currentTab = 'developer'; storage.currentTab = currentTab; updateTabDisplay(); LK.effects.flashScreen(0x50fa7b, 500); } else { LK.effects.flashScreen(0xff5555, 500); } codeInputContainer.visible = false; isInputting = false; }, 500); } } }; numberButtons.push(numButton); } // Close button var closeInputButton = codeInputContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 200, height: 100 })); closeInputButton.x = inputPanel.x + 500; closeInputButton.y = inputPanel.y - 250; closeInputButton.tint = 0xff5555; var closeInputText = new Text2('X', { size: 60, fill: 0xffffff }); closeInputText.anchor.set(0.5, 0.5); closeInputText.x = closeInputButton.x; closeInputText.y = closeInputButton.y; codeInputContainer.addChild(closeInputText); closeInputButton.down = function () { codeInputContainer.visible = false; isInputting = false; }; } // Function to update tab visibility function updateTabDisplay() { // Show/hide developer tab based on unlock status developerTab.visible = developerTabUnlocked; developerTabShadow.visible = developerTabUnlocked; developerTabText.visible = developerTabUnlocked; if (currentTab === 'infinity') { // Show infinity mode elements button.visible = true; buttonText.visible = true; buttonShadow.visible = true; counterText.visible = true; counterText.setText('Clicks: ' + clickCount); coinsText.visible = true; // Hide other mode elements cardSlotsContainer.visible = false; storeContainer.visible = false; cardsMenuContainer.visible = false; developerContainer.visible = false; // Hide buy slot button updateBuySlotButton(); // Update tab colors infinityTab.tint = 0x8b5cf6; cardsTab.tint = 0x4a90e2; if (developerTabUnlocked) developerTab.tint = 0x4a90e2; } else if (currentTab === 'cards') { // Show cards mode elements with card slots button.visible = false; buttonText.visible = false; buttonShadow.visible = false; counterText.visible = false; coinsText.visible = true; cardSlotsContainer.visible = true; storeContainer.visible = false; cardsMenuContainer.visible = true; developerContainer.visible = false; // Update card slots display updateCardSlots(); // Update buy slot button visibility updateBuySlotButton(); // Update tab colors infinityTab.tint = 0x4a90e2; cardsTab.tint = 0x8b5cf6; if (developerTabUnlocked) developerTab.tint = 0x4a90e2; } else if (currentTab === 'store') { // Show store mode elements button.visible = false; buttonText.visible = false; buttonShadow.visible = false; counterText.visible = false; coinsText.visible = true; cardSlotsContainer.visible = false; storeContainer.visible = true; cardsMenuContainer.visible = false; developerContainer.visible = false; // Update store display updateStoreDisplay(); // Update tab colors infinityTab.tint = 0x4a90e2; cardsTab.tint = 0x8b5cf6; if (developerTabUnlocked) developerTab.tint = 0x4a90e2; } else if (currentTab === 'developer') { // Show developer mode elements button.visible = false; buttonText.visible = false; buttonShadow.visible = false; counterText.visible = false; coinsText.visible = true; cardSlotsContainer.visible = false; storeContainer.visible = false; cardsMenuContainer.visible = false; developerContainer.visible = true; showDeveloperMode(); // Update tab colors infinityTab.tint = 0x4a90e2; cardsTab.tint = 0x4a90e2; if (developerTabUnlocked) developerTab.tint = 0x8b5cf6; } } // Card selector container var cardSelectorContainer = new Container(); game.addChild(cardSelectorContainer); var selectedSlotIndex = -1; // Function to open card selector function openCardSelector(slotIndex) { selectedSlotIndex = slotIndex; // Clear existing selector UI cardSelectorContainer.removeChildren(); cardSelectorContainer.visible = true; // Create background overlay var overlay = cardSelectorContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 2048, height: 2732 })); overlay.tint = 0x000000; overlay.alpha = 0.7; overlay.x = 2048 / 2; overlay.y = 2732 / 2; // Create selector panel var selectorPanel = cardSelectorContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 1600, height: 2000 })); selectorPanel.tint = 0x2d3748; selectorPanel.x = 2048 / 2; selectorPanel.y = 2732 / 2; // Title var titleText = new Text2('Select Card for Slot ' + (slotIndex + 1), { size: 80, fill: 0xffffff }); titleText.anchor.set(0.5, 0.5); titleText.x = selectorPanel.x; titleText.y = selectorPanel.y - 800; cardSelectorContainer.addChild(titleText); // Close button var closeButton = cardSelectorContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 200, height: 100 })); closeButton.x = selectorPanel.x + 700; closeButton.y = selectorPanel.y - 800; closeButton.tint = 0xff5555; var closeText = new Text2('X', { size: 60, fill: 0xffffff }); closeText.anchor.set(0.5, 0.5); closeText.x = closeButton.x; closeText.y = closeButton.y; cardSelectorContainer.addChild(closeText); closeButton.down = function () { cardSelectorContainer.visible = false; selectedSlotIndex = -1; }; // Empty slot option var emptySlotButton = cardSelectorContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 1400, height: 150 })); emptySlotButton.x = selectorPanel.x; emptySlotButton.y = selectorPanel.y - 600; emptySlotButton.tint = 0x4a90e2; var emptyText = new Text2('Remove Card (Empty Slot)', { size: 60, fill: 0xffffff }); emptyText.anchor.set(0.5, 0.5); emptyText.x = emptySlotButton.x; emptyText.y = emptySlotButton.y; cardSelectorContainer.addChild(emptyText); emptySlotButton.down = function () { equippedCards[selectedSlotIndex] = null; // Store only card names for storage compatibility var equippedCardNames = []; for (var i = 0; i < equippedCards.length; i++) { equippedCardNames[i] = equippedCards[i] ? equippedCards[i].name : null; } storage.equippedCards = equippedCardNames; updateCardSlots(); cardSelectorContainer.visible = false; selectedSlotIndex = -1; }; // Show all owned cards var displayIndex = 0; for (var i = 0; i < ownedCards.length; i++) { var card = ownedCards[i]; var cardButton = cardSelectorContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 1400, height: 180 })); cardButton.x = selectorPanel.x; cardButton.y = selectorPanel.y - 400 + displayIndex * 200; cardButton.tint = 0x8b5cf6; var cardNameText = new Text2(card.name, { size: 60, fill: 0xffffff }); cardNameText.anchor.set(0.5, 0.4); cardNameText.x = cardButton.x; cardNameText.y = cardButton.y - 30; cardSelectorContainer.addChild(cardNameText); var cardDescText = new Text2(card.description, { size: 40, fill: 0xbd93f9 }); cardDescText.anchor.set(0.5, 0.6); cardDescText.x = cardButton.x; cardDescText.y = cardButton.y + 30; cardSelectorContainer.addChild(cardDescText); cardButton.cardData = card; cardButton.down = function () { // Check if this card is already equipped in another slot var alreadyEquipped = false; for (var j = 0; j < equippedCards.length; j++) { if (equippedCards[j] && equippedCards[j].name === this.cardData.name) { alreadyEquipped = true; break; } } // Only allow equipping if not already equipped if (!alreadyEquipped) { equippedCards[selectedSlotIndex] = this.cardData; // Store only card names for storage compatibility var equippedCardNames = []; for (var i = 0; i < equippedCards.length; i++) { equippedCardNames[i] = equippedCards[i] ? equippedCards[i].name : null; } storage.equippedCards = equippedCardNames; updateCardSlots(); cardSelectorContainer.visible = false; selectedSlotIndex = -1; } else { // Flash red to indicate card is already equipped LK.effects.flashScreen(0xff5555, 300); } }; displayIndex++; } // Handle case when no cards are available if (ownedCards.length === 0) { var noCardsText = new Text2('No cards owned. Visit the store to buy cards!', { size: 60, fill: 0xff79c6 }); noCardsText.anchor.set(0.5, 0.5); noCardsText.x = selectorPanel.x; noCardsText.y = selectorPanel.y - 200; cardSelectorContainer.addChild(noCardsText); } } // Function to update card slots display function updateCardSlots() { // Clear existing slot UI cardsScrollContainer.removeChildren(); cardSlotButtons = []; cardSlotTexts = []; // Reset scroll position cardsScrollY = 0; cardsScrollContainer.y = 0; // Create card slots for (var i = 0; i < cardSlots; i++) { var slotButton = cardsScrollContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 600, height: 240 })); slotButton.x = 2048 / 2 - 700 + i % 3 * 700; slotButton.y = 1000 + Math.floor(i / 3) * 500; var equippedCard = equippedCards[i]; var slotText = new Text2(equippedCard ? equippedCard.name : 'Empty Slot', { size: 50, fill: 0xffffff }); slotText.anchor.set(0.5, 0.5); slotText.x = slotButton.x; slotText.y = slotButton.y; cardsScrollContainer.addChild(slotText); cardSlotButtons.push(slotButton); cardSlotTexts.push(slotText); // Add click handler to slot slotButton.slotIndex = i; slotButton.down = function () { if (!cardsScrolling) { openCardSelector(this.slotIndex); } }; } } // Function to update store display function updateStoreDisplay() { // Clear existing store UI storeContainer.removeChildren(); // Add back button var backButton = storeContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 300, height: 120 })); backButton.x = 150; backButton.y = 350; var backText = new Text2('BACK', { size: 50, fill: 0xffffff }); backText.anchor.set(0.5, 0.5); backText.x = backButton.x; backText.y = backButton.y; storeContainer.addChild(backText); backButton.down = function () { currentTab = 'cards'; storage.currentTab = currentTab; updateTabDisplay(); }; for (var i = 0; i < storeCards.length; i++) { var card = storeCards[i]; // Count how many of this card the player owns var ownedCount = 0; for (var j = 0; j < ownedCards.length; j++) { if (ownedCards[j].name === card.name) { ownedCount++; } } var cardButton = storeContainer.addChild(LK.getAsset('button', { anchorX: 0.5, anchorY: 0.5, width: 800, height: 200 })); cardButton.x = 2048 / 2; cardButton.y = 800 + i * 240; var cardText = new Text2(card.name + ' - ' + card.price + ' coins (Owned: ' + ownedCount + ')', { size: 60, fill: 0xffffff }); cardText.anchor.set(0.5, 0.4); cardText.x = cardButton.x; cardText.y = cardButton.y - 30; storeContainer.addChild(cardText); var descText = new Text2(card.description, { size: 40, fill: 0xbd93f9 }); descText.anchor.set(0.5, 0.6); descText.x = cardButton.x; descText.y = cardButton.y + 30; storeContainer.addChild(descText); cardButton.cardData = card; cardButton.down = function () { if (coins >= this.cardData.price) { coins -= this.cardData.price; ownedCards.push(this.cardData); try { if (storage) { storage.coins = coins; // Convert ownedCards to storage-compatible format var ownedCardNames = []; for (var k = 0; k < ownedCards.length; k++) { ownedCardNames.push(ownedCards[k].name); } storage.ownedCards = ownedCardNames; } } catch (e) { console.log('Storage error:', e); } coinsText.setText('Coins: ' + coins); // Update store display to show new count updateStoreDisplay(); // Visual feedback tween(this, { tint: 0x00ff00 }, { duration: 200 }); LK.setTimeout(function () { tween(this, { tint: 0xffffff }, { duration: 200 }); }.bind(this), 200); } }; } } // Tab click handlers infinityTab.down = function () { currentTab = 'infinity'; storage.currentTab = currentTab; updateTabDisplay(); }; cardsTab.down = function () { currentTab = 'cards'; storage.currentTab = currentTab; updateTabDisplay(); }; // Developer tab click handler developerTab.down = function () { if (developerTabUnlocked) { currentTab = 'developer'; storage.currentTab = currentTab; updateTabDisplay(); } }; // Cards menu click handlers storeMenuButton.down = function () { currentTab = 'store'; storage.currentTab = currentTab; updateTabDisplay(); }; // Cards tab scrolling handlers cardSlotsContainer.down = function (x, y, obj) { if (currentTab === 'cards') { cardsScrolling = false; cardsHolding = false; cardsStartY = y; cardsLastY = y; // Start hold timer - enable scrolling after 200ms of holding cardsHoldTimer = LK.setTimeout(function () { cardsHolding = true; }, 200); } }; cardSlotsContainer.move = function (x, y, obj) { if (currentTab === 'cards' && cardsHolding) { var deltaY = y - cardsLastY; if (Math.abs(deltaY) > 5) { cardsScrolling = true; cardsScrollY += deltaY; // Limit scrolling bounds var maxScroll = 0; var minScroll = Math.min(0, 2732 - (1400 + Math.floor(cardSlots / 3) * 500 + 300)); cardsScrollY = Math.max(minScroll, Math.min(maxScroll, cardsScrollY)); cardsScrollContainer.y = cardsScrollY; } cardsLastY = y; } }; cardSlotsContainer.up = function (x, y, obj) { if (currentTab === 'cards') { // Clear hold timer if it exists if (cardsHoldTimer) { LK.clearTimeout(cardsHoldTimer); cardsHoldTimer = null; } // Reset hold state cardsHolding = false; // Reset scrolling flag after a short delay LK.setTimeout(function () { cardsScrolling = false; }, 100); } }; // Auto clicker functionality from cards var autoClickerTimer = null; function checkCardEffects() { // Check for auto clicker card var hasAutoClicker = false; for (var i = 0; i < equippedCards.length; i++) { if (equippedCards[i] && equippedCards[i].name === 'Auto Clicker') { hasAutoClicker = true; break; } } if (hasAutoClicker && !autoClickerTimer && currentTab === 'infinity') { autoClickerTimer = LK.setInterval(function () { processClick(1); }, 1000); } else if (!hasAutoClicker && autoClickerTimer) { LK.clearInterval(autoClickerTimer); autoClickerTimer = null; } } // Function to process clicks with card effects function processClick(baseClicks) { var finalClicks = baseClicks; var coinsEarned = 0; // Start with 0 coins, earn based on chance var isCritical = false; var isLucky = false; var coinDropChance = 0.3; // 30% chance to get coins on click var bonusCoinsChance = 0.1; // 10% chance for bonus coins // Check for coin drops if (Math.random() < coinDropChance) { coinsEarned = 1; // Check for bonus coins if (Math.random() < bonusCoinsChance) { coinsEarned = 3; // Bonus coin drop } // Create visual coin drop effect createCoinDrop(button.x, button.y, coinsEarned); } // Check equipped cards for effects for (var i = 0; i < equippedCards.length; i++) { var card = equippedCards[i]; if (!card) { continue; } if (card.name === 'Critical Hit' && Math.random() < 0.15) { finalClicks *= 2; isCritical = true; } if (card.name === 'Double Coins' && coinsEarned > 0) { coinsEarned *= 2; } if (card.name === 'Lucky Strike' && Math.random() < 0.10) { finalClicks *= 5; isLucky = true; } } clickCount += finalClicks; // Don't add coins here - let the animation handle it storage.clickCount = clickCount; counterText.setText('Clicks: ' + clickCount); // Don't update coins text here - let the animation handle it // Visual feedback for special effects if (isCritical || isLucky) { var effectText = isCritical ? 'CRITICAL!' : 'LUCKY STRIKE!'; LK.effects.flashScreen(isCritical ? 0xff5555 : 0x50fa7b, 300); buttonText.setText(effectText); } // Check for jumpscare at every hundred if (clickCount % 100 === 0) { triggerJumpscare(); } } // Function to create visual coin drop effect function createCoinDrop(startX, startY, coinValue) { // Create coin visual - start from bottom of screen var coinDrop = game.addChild(LK.getAsset('coin', { anchorX: 0.5, anchorY: 0.5, width: 80, height: 80 })); coinDrop.x = startX + (Math.random() * 100 - 50); // Random spread around button coinDrop.y = 2732; // Start from bottom of screen coinDrop.tint = 0xff79c6; // Coral pink color // Create coin text var coinText = new Text2('+' + coinValue, { size: 60, fill: 0xff79c6 }); coinText.anchor.set(0.5, 0.5); coinText.x = coinDrop.x; coinText.y = coinDrop.y - 20; game.addChild(coinText); // Animate coin jumping up to coin counter with bounce effect tween(coinDrop, { x: coinsText.x, y: coinsText.y }, { duration: 800, easing: tween.bounceOut, onFinish: function onFinish() { // Update coin counter when coin reaches destination coins += coinValue; storage.coins = coins; coinsText.setText('Coins: ' + coins); // Flash the coin counter to show update tween(coinsText, { scaleX: 1.2, scaleY: 1.2 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(coinsText, { scaleX: 1.0, scaleY: 1.0 }, { duration: 100, easing: tween.easeOut }); } }); } }); tween(coinText, { x: coinsText.x, y: coinsText.y - 50 }, { duration: 800, easing: tween.bounceOut }); // Remove coin after animation LK.setTimeout(function () { if (coinDrop.parent) { coinDrop.destroy(); } if (coinText.parent) { coinText.destroy(); } }, 1000); } // Function to trigger jumpscare function triggerJumpscare() { // Array of scary messages var scaryMessages = ['BOO!', 'GOTCHA!', 'SURPRISE!', 'SCARED YET?', 'JUMP!', 'AAAHHH!', 'SPOOKY!', 'FEAR ME!']; var randomMessage = scaryMessages[Math.floor(Math.random() * scaryMessages.length)]; // Random jumpscare type (0-3) var jumpscareType = Math.floor(Math.random() * 4); if (jumpscareType === 0) { // Type 1: Pink flash with dramatic scale and shake LK.effects.flashScreen(0xff5555, 500); tween(button, { scaleX: 3, scaleY: 3 }, { duration: 200, easing: tween.bounceOut }); tween(button, { x: button.x + Math.random() * 40 - 20, y: button.y + Math.random() * 40 - 20 }, { duration: 50 }); } else if (jumpscareType === 1) { // Type 2: Purple flash with spin and grow LK.effects.flashScreen(0x8b5cf6, 700); tween(button, { scaleX: 2.5, scaleY: 2.5, rotation: Math.PI * 2 }, { duration: 400, easing: tween.elasticOut }); } else if (jumpscareType === 2) { // Type 3: Orange flash with rapid shake LK.effects.flashScreen(0xffb86c, 600); var shakeCount = 0; var shakeInterval = LK.setInterval(function () { button.x = 2048 / 2 + Math.random() * 60 - 30; button.y = 2732 / 2 - 100 + Math.random() * 60 - 30; shakeCount++; if (shakeCount >= 10) { LK.clearInterval(shakeInterval); } }, 30); } else { // Type 4: Green flash with wild scaling LK.effects.flashScreen(0x50fa7b, 400); tween(button, { scaleX: 4, scaleY: 0.5 }, { duration: 150, easing: tween.easeIn }); LK.setTimeout(function () { tween(button, { scaleX: 0.5, scaleY: 4 }, { duration: 150, easing: tween.easeOut }); }, 150); } // Scale back down after a moment LK.setTimeout(function () { tween(button, { scaleX: 1, scaleY: 1, rotation: 0, x: 2048 / 2, y: 2732 / 2 - 100 }, { duration: 300, easing: tween.easeOut }); tween(buttonShadow, { scaleX: 1, scaleY: 1, rotation: 0, x: 2048 / 2 + 8, y: 2732 / 2 - 100 + 8 }, { duration: 300, easing: tween.easeOut }); }, 300); // Change button text to random scary message buttonText.setText(randomMessage + ' ' + clickCount + ' CLICKS!'); } // Handle button clicks button.down = function (x, y, obj) { if (currentTab === 'infinity') { processClick(1); if (clickCount % 100 !== 0) { // Change button text to random message buttonText.setText(buttonTexts[Math.floor(Math.random() * buttonTexts.length)]); } // Play click sound LK.getSound('click').play(); } // Visual feedback - scale button down slightly and move shadow button.scaleX = 0.95; button.scaleY = 0.95; buttonShadow.scaleX = 0.95; buttonShadow.scaleY = 0.95; buttonShadow.x = 2048 / 2 + 4; buttonShadow.y = 2732 / 2 - 100 + 4; }; button.up = function (x, y, obj) { // Return button to normal size and shadow position button.scaleX = 1.0; button.scaleY = 1.0; buttonShadow.scaleX = 1.0; buttonShadow.scaleY = 1.0; buttonShadow.x = 2048 / 2 + 8; buttonShadow.y = 2732 / 2 - 100 + 8; }; // Game update loop game.update = function () { checkCardEffects(); }; // Weird logo click handler weirdLogo.down = function () { if (developerMode && !developerTabUnlocked) { showDeveloperMode(); } else if (!developerMode) { showCodeInput(); } }; // Initialize containers as hidden cardSelectorContainer.visible = false; developerContainer.visible = false; codeInputContainer.visible = false; // Initialize the display updateTabDisplay(); // Start background music LK.playMusic('background'); ;
/****
* Plugins
****/
var storage = LK.import("@upit/storage.v1");
var tween = LK.import("@upit/tween.v1");
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a2e
});
/****
* Game Code
****/
var currentTab = storage.currentTab || 'infinity';
var clickCount = storage.clickCount || 0;
var developerMode = storage.developerMode || false;
var developerTabUnlocked = storage.developerTabUnlocked || false;
var inputCode = '';
var isInputting = false;
// Create weird logo in top right corner
var weirdLogo = game.addChild(LK.getAsset('weirdLogo', {
anchorX: 0.5,
anchorY: 0.5,
width: 120,
height: 120
}));
weirdLogo.x = 2048 - 150;
weirdLogo.y = 150;
weirdLogo.tint = 0x420069;
// Make the logo spin continuously
var logoSpinTimer = LK.setInterval(function () {
weirdLogo.rotation += 0.1;
// Random color changes
if (Math.random() < 0.1) {
weirdLogo.tint = Math.random() * 0xffffff;
}
}, 50);
// Developer mode UI container
var developerContainer = new Container();
game.addChild(developerContainer);
// Code input overlay
var codeInputContainer = new Container();
game.addChild(codeInputContainer);
// Store cards definition (needed before equippedCards initialization)
var storeCards = [{
name: 'Critical Hit',
description: '15% chance for critical hit (2x damage)',
price: 100
}, {
name: 'Auto Clicker',
description: 'One click per second automatically',
price: 200
}, {
name: 'Double Coins',
description: 'Earn 2x coins from clicks',
price: 300
}, {
name: 'Lucky Strike',
description: '10% chance for 5x click value',
price: 250
}];
// Cards and store variables
var cards = storage.cards || [];
// Convert stored owned cards back to objects
var storedOwnedCards = storage.ownedCards || [];
var ownedCards = [];
for (var i = 0; i < storedOwnedCards.length; i++) {
// Find the card object from storeCards array
for (var j = 0; j < storeCards.length; j++) {
if (storeCards[j].name === storedOwnedCards[i]) {
ownedCards.push(storeCards[j]);
break;
}
}
}
// Convert stored equipped cards back to objects
var storedEquippedCards = storage.equippedCards || [];
var equippedCards = [];
for (var i = 0; i < storedEquippedCards.length; i++) {
if (storedEquippedCards[i]) {
// Find the card object from storeCards array
for (var j = 0; j < storeCards.length; j++) {
if (storeCards[j].name === storedEquippedCards[i]) {
equippedCards[i] = storeCards[j];
break;
}
}
} else {
equippedCards[i] = null;
}
}
var cardSlots = storage.cardSlots || 1;
var coins = storage.coins || 0;
var currentTab = storage.currentTab || 'infinity';
// Create tab button shadows
var infinityTabShadow = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 500,
height: 160
}));
infinityTabShadow.tint = 0x000000;
infinityTabShadow.alpha = 0.3;
infinityTabShadow.x = 2048 / 2 - 400 + 6;
infinityTabShadow.y = 200 + 6;
var cardsTabShadow = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 500,
height: 160
}));
cardsTabShadow.tint = 0x000000;
cardsTabShadow.alpha = 0.3;
cardsTabShadow.x = 2048 / 2 + 400 + 6;
cardsTabShadow.y = 200 + 6;
// Developer tab shadow (initially hidden)
var developerTabShadow = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 400,
height: 160
}));
developerTabShadow.tint = 0x000000;
developerTabShadow.alpha = 0.3;
developerTabShadow.x = 2048 / 2 + 6;
developerTabShadow.y = 350 + 6;
developerTabShadow.visible = false;
// Create tab buttons
var infinityTab = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 500,
height: 160
}));
infinityTab.x = 2048 / 2 - 400;
infinityTab.y = 200;
var cardsTab = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 500,
height: 160
}));
cardsTab.x = 2048 / 2 + 400;
cardsTab.y = 200;
// Developer tab button (initially hidden)
var developerTab = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 400,
height: 160
}));
developerTab.x = 2048 / 2;
developerTab.y = 350;
developerTab.tint = 0x420069;
developerTab.visible = false;
// Tab text
var infinityTabText = new Text2('INFINITY', {
size: 60,
fill: 0xffffff
});
infinityTabText.anchor.set(0.5, 0.5);
infinityTabText.x = infinityTab.x;
infinityTabText.y = infinityTab.y;
game.addChild(infinityTabText);
var cardsTabText = new Text2('CARDS', {
size: 60,
fill: 0xffffff
});
cardsTabText.anchor.set(0.5, 0.5);
cardsTabText.x = cardsTab.x;
cardsTabText.y = cardsTab.y;
game.addChild(cardsTabText);
// Developer tab text (initially hidden)
var developerTabText = new Text2('DEVELOPER', {
size: 50,
fill: 0xffffff
});
developerTabText.anchor.set(0.5, 0.5);
developerTabText.x = developerTab.x;
developerTabText.y = developerTab.y;
developerTabText.visible = false;
game.addChild(developerTabText);
// Create button shadow
var buttonShadow = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5
}));
buttonShadow.tint = 0x000000;
buttonShadow.alpha = 0.3;
buttonShadow.x = 2048 / 2 + 8;
buttonShadow.y = 2732 / 2 - 100 + 8;
// Create the main button
var button = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5
}));
// Position button in center of screen
button.x = 2048 / 2;
button.y = 2732 / 2 - 100;
// Array of random button texts
var buttonTexts = ['CLICK ME!', 'TAP HERE!', 'PRESS ME!', 'HIT IT!', 'CLICK NOW!', 'TAP AWAY!', 'PUSH IT!', 'GO AHEAD!', 'CLICK THIS!', 'TAP TAP!'];
// Create button text with random initial text
var buttonText = new Text2(buttonTexts[Math.floor(Math.random() * buttonTexts.length)], {
size: 60,
fill: 0xffffff
});
buttonText.anchor.set(0.5, 0.5);
buttonText.x = button.x;
buttonText.y = button.y;
game.addChild(buttonText);
// Create counter text
var counterText = new Text2('Clicks: 0', {
size: 160,
fill: 0x50fa7b
});
counterText.anchor.set(0.5, 0.5);
counterText.x = 2048 / 2;
counterText.y = 2732 / 2 + 300;
game.addChild(counterText);
// Create coins display
var coinsText = new Text2('Coins: ' + coins, {
size: 100,
fill: 0xff79c6
});
coinsText.anchor.set(0.5, 0.5);
coinsText.x = 2048 / 2 - 300;
coinsText.y = 700;
game.addChild(coinsText);
// Create buy slot button next to coin counter
var buySlotButtonMain = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 400,
height: 120
}));
buySlotButtonMain.x = 2048 / 2 + 100;
buySlotButtonMain.y = 700;
buySlotButtonMain.tint = 0x50fa7b;
buySlotButtonMain.visible = false;
var buySlotTextMain = new Text2('Buy Slot (50)', {
size: 50,
fill: 0xffffff
});
buySlotTextMain.anchor.set(0.5, 0.5);
buySlotTextMain.x = buySlotButtonMain.x;
buySlotTextMain.y = buySlotButtonMain.y;
buySlotTextMain.visible = false;
game.addChild(buySlotTextMain);
// Create sell slot button next to buy slot button
var sellSlotButtonMain = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 400,
height: 120
}));
sellSlotButtonMain.x = 2048 / 2 + 500;
sellSlotButtonMain.y = 700;
sellSlotButtonMain.tint = 0xff5555;
sellSlotButtonMain.visible = false;
var sellSlotTextMain = new Text2('Sell Slot (25)', {
size: 50,
fill: 0xffffff
});
sellSlotTextMain.anchor.set(0.5, 0.5);
sellSlotTextMain.x = sellSlotButtonMain.x;
sellSlotTextMain.y = sellSlotButtonMain.y;
sellSlotTextMain.visible = false;
game.addChild(sellSlotTextMain);
sellSlotButtonMain.down = function () {
if (cardSlots > 1) {
// Remove card from the last slot if it exists
if (equippedCards[cardSlots - 1]) {
equippedCards[cardSlots - 1] = null;
}
// Remove the slot
cardSlots--;
coins += 25;
storage.coins = coins;
storage.cardSlots = cardSlots;
// Update equipped cards storage
var equippedCardNames = [];
for (var i = 0; i < equippedCards.length; i++) {
equippedCardNames[i] = equippedCards[i] ? equippedCards[i].name : null;
}
storage.equippedCards = equippedCardNames;
coinsText.setText('Coins: ' + coins);
updateCardSlots();
updateBuySlotButton();
}
};
buySlotButtonMain.down = function () {
if (coins >= 50 && cardSlots < 9) {
coins -= 50;
cardSlots++;
storage.coins = coins;
storage.cardSlots = cardSlots;
coinsText.setText('Coins: ' + coins);
updateCardSlots();
updateBuySlotButton();
}
};
function updateBuySlotButton() {
if (currentTab === 'cards') {
// Show buy button only if less than 9 slots
if (cardSlots < 9) {
buySlotButtonMain.visible = true;
buySlotTextMain.visible = true;
} else {
buySlotButtonMain.visible = false;
buySlotTextMain.visible = false;
}
// Show sell button only if more than 1 slot
if (cardSlots > 1) {
sellSlotButtonMain.visible = true;
sellSlotTextMain.visible = true;
} else {
sellSlotButtonMain.visible = false;
sellSlotTextMain.visible = false;
}
} else {
buySlotButtonMain.visible = false;
buySlotTextMain.visible = false;
sellSlotButtonMain.visible = false;
sellSlotTextMain.visible = false;
}
}
// Cards menu container
var cardsMenuContainer = new Container();
game.addChild(cardsMenuContainer);
// Create store menu button shadow
var storeMenuButtonShadow = cardsMenuContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 800,
height: 200
}));
storeMenuButtonShadow.tint = 0x000000;
storeMenuButtonShadow.alpha = 0.3;
storeMenuButtonShadow.x = 2048 / 2 + 8;
storeMenuButtonShadow.y = 400 + 8;
// Create store menu button only
var storeMenuButton = cardsMenuContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 800,
height: 200
}));
storeMenuButton.x = 2048 / 2;
storeMenuButton.y = 400;
var storeMenuText = new Text2('STORE', {
size: 80,
fill: 0xffffff
});
storeMenuText.anchor.set(0.5, 0.5);
storeMenuText.x = storeMenuButton.x;
storeMenuText.y = storeMenuButton.y;
cardsMenuContainer.addChild(storeMenuText);
// Cards tab UI elements
var cardSlotsContainer = new Container();
game.addChild(cardSlotsContainer);
var cardSlotButtons = [];
var cardSlotTexts = [];
// Scrolling variables for cards tab
var cardsScrollY = 0;
var cardsScrolling = false;
var cardsStartY = 0;
var cardsLastY = 0;
var cardsHolding = false;
var cardsHoldTimer = null;
var cardsScrollContainer = new Container();
cardSlotsContainer.addChild(cardsScrollContainer);
// Store tab UI elements
var storeContainer = new Container();
game.addChild(storeContainer);
// Function to show developer mode
function showDeveloperMode() {
developerContainer.removeChildren();
developerContainer.visible = true;
// Background overlay
var devOverlay = developerContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 2048,
height: 2732
}));
devOverlay.tint = 0x000000;
devOverlay.alpha = 0.8;
devOverlay.x = 2048 / 2;
devOverlay.y = 2732 / 2;
// Developer panel
var devPanel = developerContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 1800,
height: 2200
}));
devPanel.tint = 0x1a1a2e;
devPanel.x = 2048 / 2;
devPanel.y = 2732 / 2;
// Title
var devTitle = new Text2('DEVELOPER MODE', {
size: 100,
fill: 0x42069
});
devTitle.anchor.set(0.5, 0.5);
devTitle.x = devPanel.x;
devTitle.y = devPanel.y - 900;
developerContainer.addChild(devTitle);
// Close button
var closeDevButton = developerContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 200,
height: 100
}));
closeDevButton.x = devPanel.x + 800;
closeDevButton.y = devPanel.y - 900;
closeDevButton.tint = 0xff5555;
var closeDevText = new Text2('X', {
size: 60,
fill: 0xffffff
});
closeDevText.anchor.set(0.5, 0.5);
closeDevText.x = closeDevButton.x;
closeDevText.y = closeDevButton.y;
developerContainer.addChild(closeDevText);
closeDevButton.down = function () {
developerContainer.visible = false;
};
// Add coins button
var addCoinsButton = developerContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 800,
height: 200
}));
addCoinsButton.x = devPanel.x;
addCoinsButton.y = devPanel.y - 600;
addCoinsButton.tint = 0x50fa7b;
var addCoinsText = new Text2('Add 1000 Coins', {
size: 80,
fill: 0xffffff
});
addCoinsText.anchor.set(0.5, 0.5);
addCoinsText.x = addCoinsButton.x;
addCoinsText.y = addCoinsButton.y;
developerContainer.addChild(addCoinsText);
addCoinsButton.down = function () {
coins += 1000;
storage.coins = coins;
coinsText.setText('Coins: ' + coins);
LK.effects.flashScreen(0x50fa7b, 300);
};
// Max clicks button
var maxClicksButton = developerContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 800,
height: 200
}));
maxClicksButton.x = devPanel.x;
maxClicksButton.y = devPanel.y - 300;
maxClicksButton.tint = 0x8b5cf6;
var maxClicksText = new Text2('Add 10000 Clicks', {
size: 80,
fill: 0xffffff
});
maxClicksText.anchor.set(0.5, 0.5);
maxClicksText.x = maxClicksButton.x;
maxClicksText.y = maxClicksButton.y;
developerContainer.addChild(maxClicksText);
maxClicksButton.down = function () {
clickCount += 10000;
storage.clickCount = clickCount;
counterText.setText('Clicks: ' + clickCount);
LK.effects.flashScreen(0x8b5cf6, 300);
};
// Unlock all cards button
var unlockCardsButton = developerContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 800,
height: 200
}));
unlockCardsButton.x = devPanel.x;
unlockCardsButton.y = devPanel.y;
unlockCardsButton.tint = 0xff79c6;
var unlockCardsText = new Text2('Unlock All Cards', {
size: 80,
fill: 0xffffff
});
unlockCardsText.anchor.set(0.5, 0.5);
unlockCardsText.x = unlockCardsButton.x;
unlockCardsText.y = unlockCardsButton.y;
developerContainer.addChild(unlockCardsText);
unlockCardsButton.down = function () {
for (var i = 0; i < storeCards.length; i++) {
var alreadyOwned = false;
for (var j = 0; j < ownedCards.length; j++) {
if (ownedCards[j].name === storeCards[i].name) {
alreadyOwned = true;
break;
}
}
if (!alreadyOwned) {
ownedCards.push(storeCards[i]);
}
}
// Convert ownedCards to storage-compatible format
var ownedCardNames = [];
for (var k = 0; k < ownedCards.length; k++) {
ownedCardNames.push(ownedCards[k].name);
}
storage.ownedCards = ownedCardNames;
LK.effects.flashScreen(0xff79c6, 300);
};
// Max card slots button
var maxSlotsButton = developerContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 800,
height: 200
}));
maxSlotsButton.x = devPanel.x;
maxSlotsButton.y = devPanel.y + 300;
maxSlotsButton.tint = 0xffb86c;
var maxSlotsText = new Text2('Max Out Card Slots (9)', {
size: 80,
fill: 0xffffff
});
maxSlotsText.anchor.set(0.5, 0.5);
maxSlotsText.x = maxSlotsButton.x;
maxSlotsText.y = maxSlotsButton.y;
developerContainer.addChild(maxSlotsText);
maxSlotsButton.down = function () {
cardSlots = 9;
storage.cardSlots = cardSlots;
updateCardSlots();
updateBuySlotButton();
LK.effects.flashScreen(0xffb86c, 300);
};
// Reset game button
var resetButton = developerContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 800,
height: 200
}));
resetButton.x = devPanel.x;
resetButton.y = devPanel.y + 600;
resetButton.tint = 0xff0000;
var resetText = new Text2('Reset Game', {
size: 80,
fill: 0xffffff
});
resetText.anchor.set(0.5, 0.5);
resetText.x = resetButton.x;
resetText.y = resetButton.y;
developerContainer.addChild(resetText);
resetButton.down = function () {
// Clear all storage data
storage.clickCount = 0;
storage.coins = 0;
storage.cards = [];
storage.ownedCards = [];
storage.equippedCards = [];
storage.cardSlots = 1;
storage.currentTab = 'infinity';
storage.developerMode = false;
storage.developerTabUnlocked = false;
// Flash red and show game over to restart
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
};
// Lock developer mode button
var lockDevButton = developerContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 800,
height: 200
}));
lockDevButton.x = devPanel.x;
lockDevButton.y = devPanel.y + 900;
lockDevButton.tint = 0xff5555;
var lockDevText = new Text2('Lock Developer Mode', {
size: 80,
fill: 0xffffff
});
lockDevText.anchor.set(0.5, 0.5);
lockDevText.x = lockDevButton.x;
lockDevText.y = lockDevButton.y;
developerContainer.addChild(lockDevText);
lockDevButton.down = function () {
developerMode = false;
developerTabUnlocked = false;
storage.developerMode = developerMode;
storage.developerTabUnlocked = developerTabUnlocked;
currentTab = 'infinity';
storage.currentTab = currentTab;
updateTabDisplay();
developerContainer.visible = false;
LK.effects.flashScreen(0xff5555, 300);
};
}
// Function to show code input
function showCodeInput() {
codeInputContainer.removeChildren();
codeInputContainer.visible = true;
isInputting = true;
inputCode = '';
// Background overlay
var inputOverlay = codeInputContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 2048,
height: 2732
}));
inputOverlay.tint = 0x000000;
inputOverlay.alpha = 0.7;
inputOverlay.x = 2048 / 2;
inputOverlay.y = 2732 / 2;
// Input panel
var inputPanel = codeInputContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 1200,
height: 800
}));
inputPanel.tint = 0x2d3748;
inputPanel.x = 2048 / 2;
inputPanel.y = 2732 / 2;
// Title
var inputTitle = new Text2('Enter Developer Code', {
size: 80,
fill: 0xffffff
});
inputTitle.anchor.set(0.5, 0.5);
inputTitle.x = inputPanel.x;
inputTitle.y = inputPanel.y - 250;
codeInputContainer.addChild(inputTitle);
// Code display
var codeDisplay = new Text2('*****', {
size: 120,
fill: 0x42069
});
codeDisplay.anchor.set(0.5, 0.5);
codeDisplay.x = inputPanel.x;
codeDisplay.y = inputPanel.y - 50;
codeInputContainer.addChild(codeDisplay);
// Number buttons
var numberButtons = [];
for (var i = 0; i < 10; i++) {
var numButton = codeInputContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 120,
height: 120
}));
numButton.x = inputPanel.x - 250 + i % 5 * 125;
numButton.y = inputPanel.y + 150 + Math.floor(i / 5) * 140;
numButton.tint = 0x4a90e2;
var numText = new Text2(i.toString(), {
size: 60,
fill: 0xffffff
});
numText.anchor.set(0.5, 0.5);
numText.x = numButton.x;
numText.y = numButton.y;
codeInputContainer.addChild(numText);
numButton.digit = i;
numButton.down = function () {
if (inputCode.length < 5) {
inputCode += this.digit.toString();
var displayCode = '';
for (var j = 0; j < inputCode.length; j++) {
displayCode += inputCode[j];
}
for (var k = inputCode.length; k < 5; k++) {
displayCode += '*';
}
codeDisplay.setText(displayCode);
if (inputCode.length === 5) {
LK.setTimeout(function () {
if (inputCode === '96469') {
developerMode = true;
developerTabUnlocked = true;
storage.developerMode = developerMode;
storage.developerTabUnlocked = developerTabUnlocked;
currentTab = 'developer';
storage.currentTab = currentTab;
updateTabDisplay();
LK.effects.flashScreen(0x50fa7b, 500);
} else {
LK.effects.flashScreen(0xff5555, 500);
}
codeInputContainer.visible = false;
isInputting = false;
}, 500);
}
}
};
numberButtons.push(numButton);
}
// Close button
var closeInputButton = codeInputContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 200,
height: 100
}));
closeInputButton.x = inputPanel.x + 500;
closeInputButton.y = inputPanel.y - 250;
closeInputButton.tint = 0xff5555;
var closeInputText = new Text2('X', {
size: 60,
fill: 0xffffff
});
closeInputText.anchor.set(0.5, 0.5);
closeInputText.x = closeInputButton.x;
closeInputText.y = closeInputButton.y;
codeInputContainer.addChild(closeInputText);
closeInputButton.down = function () {
codeInputContainer.visible = false;
isInputting = false;
};
}
// Function to update tab visibility
function updateTabDisplay() {
// Show/hide developer tab based on unlock status
developerTab.visible = developerTabUnlocked;
developerTabShadow.visible = developerTabUnlocked;
developerTabText.visible = developerTabUnlocked;
if (currentTab === 'infinity') {
// Show infinity mode elements
button.visible = true;
buttonText.visible = true;
buttonShadow.visible = true;
counterText.visible = true;
counterText.setText('Clicks: ' + clickCount);
coinsText.visible = true;
// Hide other mode elements
cardSlotsContainer.visible = false;
storeContainer.visible = false;
cardsMenuContainer.visible = false;
developerContainer.visible = false;
// Hide buy slot button
updateBuySlotButton();
// Update tab colors
infinityTab.tint = 0x8b5cf6;
cardsTab.tint = 0x4a90e2;
if (developerTabUnlocked) developerTab.tint = 0x4a90e2;
} else if (currentTab === 'cards') {
// Show cards mode elements with card slots
button.visible = false;
buttonText.visible = false;
buttonShadow.visible = false;
counterText.visible = false;
coinsText.visible = true;
cardSlotsContainer.visible = true;
storeContainer.visible = false;
cardsMenuContainer.visible = true;
developerContainer.visible = false;
// Update card slots display
updateCardSlots();
// Update buy slot button visibility
updateBuySlotButton();
// Update tab colors
infinityTab.tint = 0x4a90e2;
cardsTab.tint = 0x8b5cf6;
if (developerTabUnlocked) developerTab.tint = 0x4a90e2;
} else if (currentTab === 'store') {
// Show store mode elements
button.visible = false;
buttonText.visible = false;
buttonShadow.visible = false;
counterText.visible = false;
coinsText.visible = true;
cardSlotsContainer.visible = false;
storeContainer.visible = true;
cardsMenuContainer.visible = false;
developerContainer.visible = false;
// Update store display
updateStoreDisplay();
// Update tab colors
infinityTab.tint = 0x4a90e2;
cardsTab.tint = 0x8b5cf6;
if (developerTabUnlocked) developerTab.tint = 0x4a90e2;
} else if (currentTab === 'developer') {
// Show developer mode elements
button.visible = false;
buttonText.visible = false;
buttonShadow.visible = false;
counterText.visible = false;
coinsText.visible = true;
cardSlotsContainer.visible = false;
storeContainer.visible = false;
cardsMenuContainer.visible = false;
developerContainer.visible = true;
showDeveloperMode();
// Update tab colors
infinityTab.tint = 0x4a90e2;
cardsTab.tint = 0x4a90e2;
if (developerTabUnlocked) developerTab.tint = 0x8b5cf6;
}
}
// Card selector container
var cardSelectorContainer = new Container();
game.addChild(cardSelectorContainer);
var selectedSlotIndex = -1;
// Function to open card selector
function openCardSelector(slotIndex) {
selectedSlotIndex = slotIndex;
// Clear existing selector UI
cardSelectorContainer.removeChildren();
cardSelectorContainer.visible = true;
// Create background overlay
var overlay = cardSelectorContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 2048,
height: 2732
}));
overlay.tint = 0x000000;
overlay.alpha = 0.7;
overlay.x = 2048 / 2;
overlay.y = 2732 / 2;
// Create selector panel
var selectorPanel = cardSelectorContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 1600,
height: 2000
}));
selectorPanel.tint = 0x2d3748;
selectorPanel.x = 2048 / 2;
selectorPanel.y = 2732 / 2;
// Title
var titleText = new Text2('Select Card for Slot ' + (slotIndex + 1), {
size: 80,
fill: 0xffffff
});
titleText.anchor.set(0.5, 0.5);
titleText.x = selectorPanel.x;
titleText.y = selectorPanel.y - 800;
cardSelectorContainer.addChild(titleText);
// Close button
var closeButton = cardSelectorContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 200,
height: 100
}));
closeButton.x = selectorPanel.x + 700;
closeButton.y = selectorPanel.y - 800;
closeButton.tint = 0xff5555;
var closeText = new Text2('X', {
size: 60,
fill: 0xffffff
});
closeText.anchor.set(0.5, 0.5);
closeText.x = closeButton.x;
closeText.y = closeButton.y;
cardSelectorContainer.addChild(closeText);
closeButton.down = function () {
cardSelectorContainer.visible = false;
selectedSlotIndex = -1;
};
// Empty slot option
var emptySlotButton = cardSelectorContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 1400,
height: 150
}));
emptySlotButton.x = selectorPanel.x;
emptySlotButton.y = selectorPanel.y - 600;
emptySlotButton.tint = 0x4a90e2;
var emptyText = new Text2('Remove Card (Empty Slot)', {
size: 60,
fill: 0xffffff
});
emptyText.anchor.set(0.5, 0.5);
emptyText.x = emptySlotButton.x;
emptyText.y = emptySlotButton.y;
cardSelectorContainer.addChild(emptyText);
emptySlotButton.down = function () {
equippedCards[selectedSlotIndex] = null;
// Store only card names for storage compatibility
var equippedCardNames = [];
for (var i = 0; i < equippedCards.length; i++) {
equippedCardNames[i] = equippedCards[i] ? equippedCards[i].name : null;
}
storage.equippedCards = equippedCardNames;
updateCardSlots();
cardSelectorContainer.visible = false;
selectedSlotIndex = -1;
};
// Show all owned cards
var displayIndex = 0;
for (var i = 0; i < ownedCards.length; i++) {
var card = ownedCards[i];
var cardButton = cardSelectorContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 1400,
height: 180
}));
cardButton.x = selectorPanel.x;
cardButton.y = selectorPanel.y - 400 + displayIndex * 200;
cardButton.tint = 0x8b5cf6;
var cardNameText = new Text2(card.name, {
size: 60,
fill: 0xffffff
});
cardNameText.anchor.set(0.5, 0.4);
cardNameText.x = cardButton.x;
cardNameText.y = cardButton.y - 30;
cardSelectorContainer.addChild(cardNameText);
var cardDescText = new Text2(card.description, {
size: 40,
fill: 0xbd93f9
});
cardDescText.anchor.set(0.5, 0.6);
cardDescText.x = cardButton.x;
cardDescText.y = cardButton.y + 30;
cardSelectorContainer.addChild(cardDescText);
cardButton.cardData = card;
cardButton.down = function () {
// Check if this card is already equipped in another slot
var alreadyEquipped = false;
for (var j = 0; j < equippedCards.length; j++) {
if (equippedCards[j] && equippedCards[j].name === this.cardData.name) {
alreadyEquipped = true;
break;
}
}
// Only allow equipping if not already equipped
if (!alreadyEquipped) {
equippedCards[selectedSlotIndex] = this.cardData;
// Store only card names for storage compatibility
var equippedCardNames = [];
for (var i = 0; i < equippedCards.length; i++) {
equippedCardNames[i] = equippedCards[i] ? equippedCards[i].name : null;
}
storage.equippedCards = equippedCardNames;
updateCardSlots();
cardSelectorContainer.visible = false;
selectedSlotIndex = -1;
} else {
// Flash red to indicate card is already equipped
LK.effects.flashScreen(0xff5555, 300);
}
};
displayIndex++;
}
// Handle case when no cards are available
if (ownedCards.length === 0) {
var noCardsText = new Text2('No cards owned. Visit the store to buy cards!', {
size: 60,
fill: 0xff79c6
});
noCardsText.anchor.set(0.5, 0.5);
noCardsText.x = selectorPanel.x;
noCardsText.y = selectorPanel.y - 200;
cardSelectorContainer.addChild(noCardsText);
}
}
// Function to update card slots display
function updateCardSlots() {
// Clear existing slot UI
cardsScrollContainer.removeChildren();
cardSlotButtons = [];
cardSlotTexts = [];
// Reset scroll position
cardsScrollY = 0;
cardsScrollContainer.y = 0;
// Create card slots
for (var i = 0; i < cardSlots; i++) {
var slotButton = cardsScrollContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 600,
height: 240
}));
slotButton.x = 2048 / 2 - 700 + i % 3 * 700;
slotButton.y = 1000 + Math.floor(i / 3) * 500;
var equippedCard = equippedCards[i];
var slotText = new Text2(equippedCard ? equippedCard.name : 'Empty Slot', {
size: 50,
fill: 0xffffff
});
slotText.anchor.set(0.5, 0.5);
slotText.x = slotButton.x;
slotText.y = slotButton.y;
cardsScrollContainer.addChild(slotText);
cardSlotButtons.push(slotButton);
cardSlotTexts.push(slotText);
// Add click handler to slot
slotButton.slotIndex = i;
slotButton.down = function () {
if (!cardsScrolling) {
openCardSelector(this.slotIndex);
}
};
}
}
// Function to update store display
function updateStoreDisplay() {
// Clear existing store UI
storeContainer.removeChildren();
// Add back button
var backButton = storeContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 300,
height: 120
}));
backButton.x = 150;
backButton.y = 350;
var backText = new Text2('BACK', {
size: 50,
fill: 0xffffff
});
backText.anchor.set(0.5, 0.5);
backText.x = backButton.x;
backText.y = backButton.y;
storeContainer.addChild(backText);
backButton.down = function () {
currentTab = 'cards';
storage.currentTab = currentTab;
updateTabDisplay();
};
for (var i = 0; i < storeCards.length; i++) {
var card = storeCards[i];
// Count how many of this card the player owns
var ownedCount = 0;
for (var j = 0; j < ownedCards.length; j++) {
if (ownedCards[j].name === card.name) {
ownedCount++;
}
}
var cardButton = storeContainer.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
width: 800,
height: 200
}));
cardButton.x = 2048 / 2;
cardButton.y = 800 + i * 240;
var cardText = new Text2(card.name + ' - ' + card.price + ' coins (Owned: ' + ownedCount + ')', {
size: 60,
fill: 0xffffff
});
cardText.anchor.set(0.5, 0.4);
cardText.x = cardButton.x;
cardText.y = cardButton.y - 30;
storeContainer.addChild(cardText);
var descText = new Text2(card.description, {
size: 40,
fill: 0xbd93f9
});
descText.anchor.set(0.5, 0.6);
descText.x = cardButton.x;
descText.y = cardButton.y + 30;
storeContainer.addChild(descText);
cardButton.cardData = card;
cardButton.down = function () {
if (coins >= this.cardData.price) {
coins -= this.cardData.price;
ownedCards.push(this.cardData);
try {
if (storage) {
storage.coins = coins;
// Convert ownedCards to storage-compatible format
var ownedCardNames = [];
for (var k = 0; k < ownedCards.length; k++) {
ownedCardNames.push(ownedCards[k].name);
}
storage.ownedCards = ownedCardNames;
}
} catch (e) {
console.log('Storage error:', e);
}
coinsText.setText('Coins: ' + coins);
// Update store display to show new count
updateStoreDisplay();
// Visual feedback
tween(this, {
tint: 0x00ff00
}, {
duration: 200
});
LK.setTimeout(function () {
tween(this, {
tint: 0xffffff
}, {
duration: 200
});
}.bind(this), 200);
}
};
}
}
// Tab click handlers
infinityTab.down = function () {
currentTab = 'infinity';
storage.currentTab = currentTab;
updateTabDisplay();
};
cardsTab.down = function () {
currentTab = 'cards';
storage.currentTab = currentTab;
updateTabDisplay();
};
// Developer tab click handler
developerTab.down = function () {
if (developerTabUnlocked) {
currentTab = 'developer';
storage.currentTab = currentTab;
updateTabDisplay();
}
};
// Cards menu click handlers
storeMenuButton.down = function () {
currentTab = 'store';
storage.currentTab = currentTab;
updateTabDisplay();
};
// Cards tab scrolling handlers
cardSlotsContainer.down = function (x, y, obj) {
if (currentTab === 'cards') {
cardsScrolling = false;
cardsHolding = false;
cardsStartY = y;
cardsLastY = y;
// Start hold timer - enable scrolling after 200ms of holding
cardsHoldTimer = LK.setTimeout(function () {
cardsHolding = true;
}, 200);
}
};
cardSlotsContainer.move = function (x, y, obj) {
if (currentTab === 'cards' && cardsHolding) {
var deltaY = y - cardsLastY;
if (Math.abs(deltaY) > 5) {
cardsScrolling = true;
cardsScrollY += deltaY;
// Limit scrolling bounds
var maxScroll = 0;
var minScroll = Math.min(0, 2732 - (1400 + Math.floor(cardSlots / 3) * 500 + 300));
cardsScrollY = Math.max(minScroll, Math.min(maxScroll, cardsScrollY));
cardsScrollContainer.y = cardsScrollY;
}
cardsLastY = y;
}
};
cardSlotsContainer.up = function (x, y, obj) {
if (currentTab === 'cards') {
// Clear hold timer if it exists
if (cardsHoldTimer) {
LK.clearTimeout(cardsHoldTimer);
cardsHoldTimer = null;
}
// Reset hold state
cardsHolding = false;
// Reset scrolling flag after a short delay
LK.setTimeout(function () {
cardsScrolling = false;
}, 100);
}
};
// Auto clicker functionality from cards
var autoClickerTimer = null;
function checkCardEffects() {
// Check for auto clicker card
var hasAutoClicker = false;
for (var i = 0; i < equippedCards.length; i++) {
if (equippedCards[i] && equippedCards[i].name === 'Auto Clicker') {
hasAutoClicker = true;
break;
}
}
if (hasAutoClicker && !autoClickerTimer && currentTab === 'infinity') {
autoClickerTimer = LK.setInterval(function () {
processClick(1);
}, 1000);
} else if (!hasAutoClicker && autoClickerTimer) {
LK.clearInterval(autoClickerTimer);
autoClickerTimer = null;
}
}
// Function to process clicks with card effects
function processClick(baseClicks) {
var finalClicks = baseClicks;
var coinsEarned = 0; // Start with 0 coins, earn based on chance
var isCritical = false;
var isLucky = false;
var coinDropChance = 0.3; // 30% chance to get coins on click
var bonusCoinsChance = 0.1; // 10% chance for bonus coins
// Check for coin drops
if (Math.random() < coinDropChance) {
coinsEarned = 1;
// Check for bonus coins
if (Math.random() < bonusCoinsChance) {
coinsEarned = 3; // Bonus coin drop
}
// Create visual coin drop effect
createCoinDrop(button.x, button.y, coinsEarned);
}
// Check equipped cards for effects
for (var i = 0; i < equippedCards.length; i++) {
var card = equippedCards[i];
if (!card) {
continue;
}
if (card.name === 'Critical Hit' && Math.random() < 0.15) {
finalClicks *= 2;
isCritical = true;
}
if (card.name === 'Double Coins' && coinsEarned > 0) {
coinsEarned *= 2;
}
if (card.name === 'Lucky Strike' && Math.random() < 0.10) {
finalClicks *= 5;
isLucky = true;
}
}
clickCount += finalClicks;
// Don't add coins here - let the animation handle it
storage.clickCount = clickCount;
counterText.setText('Clicks: ' + clickCount);
// Don't update coins text here - let the animation handle it
// Visual feedback for special effects
if (isCritical || isLucky) {
var effectText = isCritical ? 'CRITICAL!' : 'LUCKY STRIKE!';
LK.effects.flashScreen(isCritical ? 0xff5555 : 0x50fa7b, 300);
buttonText.setText(effectText);
}
// Check for jumpscare at every hundred
if (clickCount % 100 === 0) {
triggerJumpscare();
}
}
// Function to create visual coin drop effect
function createCoinDrop(startX, startY, coinValue) {
// Create coin visual - start from bottom of screen
var coinDrop = game.addChild(LK.getAsset('coin', {
anchorX: 0.5,
anchorY: 0.5,
width: 80,
height: 80
}));
coinDrop.x = startX + (Math.random() * 100 - 50); // Random spread around button
coinDrop.y = 2732; // Start from bottom of screen
coinDrop.tint = 0xff79c6; // Coral pink color
// Create coin text
var coinText = new Text2('+' + coinValue, {
size: 60,
fill: 0xff79c6
});
coinText.anchor.set(0.5, 0.5);
coinText.x = coinDrop.x;
coinText.y = coinDrop.y - 20;
game.addChild(coinText);
// Animate coin jumping up to coin counter with bounce effect
tween(coinDrop, {
x: coinsText.x,
y: coinsText.y
}, {
duration: 800,
easing: tween.bounceOut,
onFinish: function onFinish() {
// Update coin counter when coin reaches destination
coins += coinValue;
storage.coins = coins;
coinsText.setText('Coins: ' + coins);
// Flash the coin counter to show update
tween(coinsText, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(coinsText, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.easeOut
});
}
});
}
});
tween(coinText, {
x: coinsText.x,
y: coinsText.y - 50
}, {
duration: 800,
easing: tween.bounceOut
});
// Remove coin after animation
LK.setTimeout(function () {
if (coinDrop.parent) {
coinDrop.destroy();
}
if (coinText.parent) {
coinText.destroy();
}
}, 1000);
}
// Function to trigger jumpscare
function triggerJumpscare() {
// Array of scary messages
var scaryMessages = ['BOO!', 'GOTCHA!', 'SURPRISE!', 'SCARED YET?', 'JUMP!', 'AAAHHH!', 'SPOOKY!', 'FEAR ME!'];
var randomMessage = scaryMessages[Math.floor(Math.random() * scaryMessages.length)];
// Random jumpscare type (0-3)
var jumpscareType = Math.floor(Math.random() * 4);
if (jumpscareType === 0) {
// Type 1: Pink flash with dramatic scale and shake
LK.effects.flashScreen(0xff5555, 500);
tween(button, {
scaleX: 3,
scaleY: 3
}, {
duration: 200,
easing: tween.bounceOut
});
tween(button, {
x: button.x + Math.random() * 40 - 20,
y: button.y + Math.random() * 40 - 20
}, {
duration: 50
});
} else if (jumpscareType === 1) {
// Type 2: Purple flash with spin and grow
LK.effects.flashScreen(0x8b5cf6, 700);
tween(button, {
scaleX: 2.5,
scaleY: 2.5,
rotation: Math.PI * 2
}, {
duration: 400,
easing: tween.elasticOut
});
} else if (jumpscareType === 2) {
// Type 3: Orange flash with rapid shake
LK.effects.flashScreen(0xffb86c, 600);
var shakeCount = 0;
var shakeInterval = LK.setInterval(function () {
button.x = 2048 / 2 + Math.random() * 60 - 30;
button.y = 2732 / 2 - 100 + Math.random() * 60 - 30;
shakeCount++;
if (shakeCount >= 10) {
LK.clearInterval(shakeInterval);
}
}, 30);
} else {
// Type 4: Green flash with wild scaling
LK.effects.flashScreen(0x50fa7b, 400);
tween(button, {
scaleX: 4,
scaleY: 0.5
}, {
duration: 150,
easing: tween.easeIn
});
LK.setTimeout(function () {
tween(button, {
scaleX: 0.5,
scaleY: 4
}, {
duration: 150,
easing: tween.easeOut
});
}, 150);
}
// Scale back down after a moment
LK.setTimeout(function () {
tween(button, {
scaleX: 1,
scaleY: 1,
rotation: 0,
x: 2048 / 2,
y: 2732 / 2 - 100
}, {
duration: 300,
easing: tween.easeOut
});
tween(buttonShadow, {
scaleX: 1,
scaleY: 1,
rotation: 0,
x: 2048 / 2 + 8,
y: 2732 / 2 - 100 + 8
}, {
duration: 300,
easing: tween.easeOut
});
}, 300);
// Change button text to random scary message
buttonText.setText(randomMessage + ' ' + clickCount + ' CLICKS!');
}
// Handle button clicks
button.down = function (x, y, obj) {
if (currentTab === 'infinity') {
processClick(1);
if (clickCount % 100 !== 0) {
// Change button text to random message
buttonText.setText(buttonTexts[Math.floor(Math.random() * buttonTexts.length)]);
}
// Play click sound
LK.getSound('click').play();
}
// Visual feedback - scale button down slightly and move shadow
button.scaleX = 0.95;
button.scaleY = 0.95;
buttonShadow.scaleX = 0.95;
buttonShadow.scaleY = 0.95;
buttonShadow.x = 2048 / 2 + 4;
buttonShadow.y = 2732 / 2 - 100 + 4;
};
button.up = function (x, y, obj) {
// Return button to normal size and shadow position
button.scaleX = 1.0;
button.scaleY = 1.0;
buttonShadow.scaleX = 1.0;
buttonShadow.scaleY = 1.0;
buttonShadow.x = 2048 / 2 + 8;
buttonShadow.y = 2732 / 2 - 100 + 8;
};
// Game update loop
game.update = function () {
checkCardEffects();
};
// Weird logo click handler
weirdLogo.down = function () {
if (developerMode && !developerTabUnlocked) {
showDeveloperMode();
} else if (!developerMode) {
showCodeInput();
}
};
// Initialize containers as hidden
cardSelectorContainer.visible = false;
developerContainer.visible = false;
codeInputContainer.visible = false;
// Initialize the display
updateTabDisplay();
// Start background music
LK.playMusic('background');
;