User prompt
Şimdi bi özellik daha ekle shop kısmında 2x luck'ın altına özelliğin adı +1 STROTAGE bu özellik tüm herkes için sadece 4 kere satın alınan bilinir ve 100000 coin fiyatı vardır her alındığında oyuncu ekstradan 1 dinozor daha kullana bilir ve oyunda en fazla 5 dinozor takabilir ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
❗ basınca Yazılar birbirine karışıyor onu düzelt tıpkı sell,shop,bag ve store sekmesindeki mantık gibi her birine basıldığında altta back yazan bi sekme açılsın ve orada bakıp geri dönsün
User prompt
Tüm yumurtaların yanına ❗ koy hangi yumurtaya bastığımızda o yumurtadaki dinozorların çıkma olasılığı olan canlıların % kaç ihtimalle çıktığını ve ne işe yaradığını yazsın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Mutasyonlu PARASAUROLUPHUS ise normal PARASAUROLUPHUSa göre daha hızlı block kırsın yani irta hızda blok kırsın 2 saniyede bir yani ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Şimdi destansı yumurtada TREX çıkma şansını %3 yap SPİNO %10 GİGA %15 mutasyonlularda ise mutasyonlu BARYONYX %25 mutasyonlu DİMETRODON %17 mutasyonlu PARASAUROLUPHUS %30 olsun
User prompt
Destansı yumurtada ise TREX kazdığımız yerin etrafındaki dört kayayı birden kırar ama her tur sadece 3 kere yapabilir SPİNO kuyruk darbesi ile 3 kayayı birden kırar her tur bir kere kullanılır GİGA kaya kırma hızımızı 2x arttırır mutasyonlu BARYONYX kaya kırma hızımızı 0.9 daha hızlı yapar mutasyonlu DİMETRODON ise her tur en değerli üç fosili alır ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Nadir yumurtada ise BARYONYX 0.2x daha hızlı kayaları kazmamızı sağlar YUTY kayaları 0.7x daha hızlı kazmamızı ALLO ise 0.4x daha hızlı kaya kazmamızı sağlar ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Nerf getireceğim DİMETRODON sadece nadirligi fark etmez 2 tane fosil alır PYTHEREDON ise nadirligi fark etmez sadece 1 fosil alır her seviye başı ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Yumurta fiyatlarını 2 katına çıkar
User prompt
Her dinozorun kendine ait 1 özelliği olsun PARASAUROLUPHUS sadece çok yavaş 1 blok kırarak yardı eder PYTHEREDON değeri fark etmez sadece 1 fosil toplar DİMETRODON ise yüzeye çıkardığımız Fosillerden 3 en nadir olan tanesini toplar Fosilleri toplar ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Şimdide bag isimli bir sekme ekle shopun biraz altında olsun orada yumurtalardan çıkardığımız dinozorların nadirligine göre sıralandın ve herkesin sadece 1 dinozor kulkanma hakkı olsun ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Destansı yumurtada ise TREX,SPİNO ve GİGA olsun TREX %5 SPİNO %15 GİGA %20 şansa çıksın ama bu yumurtadan başka dinozorlarda gelebilir %30 şansa mutasyonlu BARYONYX %30 şansa ise mutasyonlu DİMETRODON çıksın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Şimdi bu yunurtaların her birinde 3 adet dinozor var sıradan yumurtada PARASOUROLUPHUS,PYTHEREDON ve DİMETRODON olsun ve hepsinin çıkma olasılığı eşit olsun ardından nadir yumurtada ise BARYONYX,YUTY ve ALLO olsun en nadirleri YUTY çıkma şansı %20 orta nadirlik ALLO olsun %35 çıkma şansı ve en az nadir olan BARYONYX %45 oranla çıksın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Back yazısı biraz daha üstte olsun
User prompt
Yumurta seçenekleri back yazısının altında olsun
User prompt
Şimdi shop sekmesine 3 adet yumurt ekle biri sıradan yumurta biri nadir diğeri ise destansı ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
2x luck fiyatı 1250 coin olsun ve yeşil butonlar daha büyük olsun yazıyı tamamen içine alsın
User prompt
Shop sekmesindeki 2x value isimli özelliği 2x luck yap ve yeşil butonlar yazıları tamamen içine alsın
User prompt
Menüye shop seçeneği ekle
User prompt
Oyun başladığında sağ ortada görünsün bu 2 özellik
User prompt
Seçenekler bunlar olsun ilk seçenek XRAY ikinci seçenek 2X MONEY üçüncü ise 2X VALUE XRAY 500 coin olsun ve satın alınınca sadece 1 seviyelik tüm fosillerin yerini göstersin 2X MONEY 10000 coin satın alındığında ise 20 seviye boyunca bulduğu tüm fosilleri satınca 2 kat daha fazla para alacak (tek seferlik) ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Şimdide oyuna oarayla satın almak için 3 seçenek ekleyelim oyun başladığında bu özellikler alt alta sağ ortada olsun
User prompt
Ayarlar özelliğini tüm herşeyden sil
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'push')' in or related to this line: 'settingsUIElements.push(settingsOverlay, backToGameButton, backToGameButtonText, backToMenuFromSettingsButton, backToMenuFromSettingsButtonText);' Line Number: 445
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Fossil = Container.expand(function (fossilType) { var self = Container.call(this); var fossilGraphics = self.attachAsset(fossilType, { anchorX: 0.5, anchorY: 0.5 }); self.fossilType = fossilType; self.isCollected = false; self.points = fossilType === 'rareFossil' ? 500 : 100; self.down = function (x, y, obj) { if (!self.isCollected) { self.collectFossil(); } }; self.collectFossil = function () { self.isCollected = true; LK.getSound('fossilFound').play(); // Apply dinosaur abilities if (selectedDinosaur === 'PYTHEREDON') { // PYTHEREDON only collects 1 fossil per level regardless of rarity var fossilsCollectedByPytheredon = storage.fossilsCollectedByPytheredon || 0; if (fossilsCollectedByPytheredon >= 1) { // Skip collection - PYTHEREDON already collected its one fossil self.animateCollection(); return; } storage.fossilsCollectedByPytheredon = fossilsCollectedByPytheredon + 1; } else if (selectedDinosaur === 'Mutated DIMETRODON') { // Mutated DIMETRODON collects 3 most valuable fossils per level self.handleMutatedDimetrodonCollection(); return; } else if (selectedDinosaur === 'DIMETRODON') { // DIMETRODON collects 2 fossils regardless of rarity self.handleDimetrodonCollection(); return; } // Add fossil to inventory playerInventory.push(self.fossilType); storage.playerInventory = playerInventory; // Award points based on extraction speed var speedBonus = Math.max(0, 100 - Math.floor(levelTimer / 100)); var totalPoints = self.points + speedBonus; // Apply 2X MONEY effect if active if (doubleMoneyLevelsLeft > 0) { totalPoints *= 2; } LK.setScore(LK.getScore() + totalPoints); scoreText.setText('Score: ' + LK.getScore()); self.animateCollection(); }; self.handleDimetrodonCollection = function () { // DIMETRODON collects 2 fossils regardless of rarity // Add current fossil first playerInventory.push(self.fossilType); // Add one more fossil if available in inventory if (playerInventory.length > 1) { playerInventory.push(playerInventory[0]); // Add any fossil from inventory } storage.playerInventory = playerInventory; // Award bonus points for rare collection var totalPoints = self.points * 2; // Double points for DIMETRODON if (doubleMoneyLevelsLeft > 0) { totalPoints *= 2; } LK.setScore(LK.getScore() + totalPoints); scoreText.setText('Score: ' + LK.getScore()); self.animateCollection(); }; self.handleMutatedDimetrodonCollection = function () { // Mutated DIMETRODON collects 3 most valuable fossils per level // Find the 3 most valuable fossils from current level var availableFossils = []; for (var i = 0; i < currentLevel.fossils.length; i++) { if (!currentLevel.fossils[i].isCollected) { availableFossils.push(currentLevel.fossils[i]); } } // Sort by fossil value (descending) availableFossils.sort(function (a, b) { return b.points - a.points; }); // Take up to 3 most valuable var fossilsToCollect = Math.min(3, availableFossils.length); var totalPoints = 0; for (var j = 0; j < fossilsToCollect; j++) { playerInventory.push(availableFossils[j].fossilType); totalPoints += availableFossils[j].points; // Mark as collected availableFossils[j].isCollected = true; availableFossils[j].animateCollection(); } storage.playerInventory = playerInventory; // Apply 2X MONEY effect if active if (doubleMoneyLevelsLeft > 0) { totalPoints *= 2; } LK.setScore(LK.getScore() + totalPoints); scoreText.setText('Score: ' + LK.getScore()); self.animateCollection(); }; self.animateCollection = function () { // Animate collection tween(self, { scaleX: 1.5, scaleY: 1.5, alpha: 0 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { currentLevel.fossilsCollected++; currentLevel.checkLevelComplete(); } }); }; return self; }); var Level = Container.expand(function (levelNumber) { var self = Container.call(this); self.levelNumber = levelNumber; self.blocks = []; self.fossils = []; self.fossilsCollected = 0; self.totalFossils = 0; self.blocksCollected = 0; self.totalBlocks = 0; self.createLevel = function () { // Create excavation site background var site = self.attachAsset('excavationSite', { anchorX: 0.5, anchorY: 0.5 }); site.x = 1024; site.y = 1000; // Determine fossils for this level (3-6 fossils) var fossilCount = 3 + Math.floor(Math.random() * 4); var fossilTypes = ['fossil1', 'fossil2', 'fossil3']; // Add rare fossil chance (higher in later levels) if (Math.random() < levelNumber * 0.05) { fossilTypes.push('rareFossil'); } self.totalFossils = fossilCount; // Create limestone blocks grid var blocksPerRow = 8; var rows = 6; var startX = 400; var startY = 400; var spacing = 140; var fossilPositions = []; for (var i = 0; i < fossilCount; i++) { var randomPos = Math.floor(Math.random() * (blocksPerRow * rows)); while (fossilPositions.indexOf(randomPos) !== -1) { randomPos = Math.floor(Math.random() * (blocksPerRow * rows)); } fossilPositions.push(randomPos); } var blockIndex = 0; for (var row = 0; row < rows; row++) { for (var col = 0; col < blocksPerRow; col++) { var block = new LimestoneBlock(); block.x = startX + col * spacing; block.y = startY + row * spacing; // Check if this block contains a fossil if (fossilPositions.indexOf(blockIndex) !== -1) { block.hasFossil = true; var fossilTypeIndex = Math.floor(Math.random() * fossilTypes.length); block.fossilType = fossilTypes[fossilTypeIndex]; } self.blocks.push(block); self.addChild(block); blockIndex++; } } self.totalBlocks = self.blocks.length; }; self.revealFossil = function (fossilType, x, y) { var fossil = new Fossil(fossilType); fossil.x = x; fossil.y = y; // Animate fossil appearance fossil.alpha = 0; fossil.scaleX = 0; fossil.scaleY = 0; self.fossils.push(fossil); self.addChild(fossil); tween(fossil, { alpha: 1, scaleX: 1, scaleY: 1 }, { duration: 400, easing: tween.easeOut }); }; self.checkBlockCollection = function () { self.blocksCollected++; if (self.blocksCollected >= self.totalBlocks) { // All blocks collected, show any remaining fossils for (var i = 0; i < self.blocks.length; i++) { var block = self.blocks[i]; if (block.hasFossil && !block.isCollected) { self.revealFossil(block.fossilType, block.x, block.y); } } } }; self.checkLevelComplete = function () { if (self.fossilsCollected >= self.totalFossils) { LK.getSound('levelComplete').play(); // Level completion bonus var timeBonus = Math.max(0, 1000 - Math.floor(levelTimer / 10)); LK.setScore(LK.getScore() + timeBonus); scoreText.setText('Score: ' + LK.getScore()); // Decrease power-up counters if (xrayLevelsLeft > 0) { xrayLevelsLeft--; storage.xrayLevelsLeft = xrayLevelsLeft; } if (doubleMoneyLevelsLeft > 0) { doubleMoneyLevelsLeft--; storage.doubleMoneyLevelsLeft = doubleMoneyLevelsLeft; } // Progress to next level after delay LK.setTimeout(function () { if (currentLevelNumber < 20) { startLevel(currentLevelNumber + 1); } else { // Game complete LK.showYouWin(); } }, 2000); } }; return self; }); var LimestoneBlock = Container.expand(function () { var self = Container.call(this); var blockGraphics = self.attachAsset('limestone', { anchorX: 0.5, anchorY: 0.5 }); self.hasFossil = false; self.fossilType = null; self.isCollected = false; self.down = function (x, y, obj) { if (!self.isCollected) { self.collectBlock(); } }; self.collectBlock = function () { // Check if dinosaur ability affects digging speed if (selectedDinosaur === 'PARASOUROLUPHUS') { // PARASOUROLUPHUS is very slow - add delay LK.setTimeout(function () { self.performCollection(); }, 1000); // 1 second delay } else if (selectedDinosaur === 'BARYONYX') { // BARYONYX is 0.2x faster (20% speed increase) LK.setTimeout(function () { self.performCollection(); }, 240); // 0.8x delay = faster mining } else if (selectedDinosaur === 'YUTY') { // YUTY is 0.7x faster (70% speed increase) LK.setTimeout(function () { self.performCollection(); }, 90); // 0.3x delay = much faster mining } else if (selectedDinosaur === 'ALLO') { // ALLO is 0.4x faster (40% speed increase) LK.setTimeout(function () { self.performCollection(); }, 180); // 0.6x delay = faster mining } else if (selectedDinosaur === 'TREX') { // TREX breaks 4 surrounding blocks, 3 uses per level var usesLeft = storage.trexUsesLeft || 0; if (usesLeft > 0) { self.performTrexCollection(); storage.trexUsesLeft = usesLeft - 1; } else { self.performCollection(); } } else if (selectedDinosaur === 'SPINO') { // SPINO tail strike breaks 3 blocks in line, 1 use per level var usesLeft = storage.spinoUsesLeft || 0; if (usesLeft > 0) { self.performSpinoCollection(); storage.spinoUsesLeft = usesLeft - 1; } else { self.performCollection(); } } else if (selectedDinosaur === 'GIGA') { // GIGA 2x mining speed LK.setTimeout(function () { self.performCollection(); }, 150); // 0.5x delay = 2x faster mining } else if (selectedDinosaur === 'Mutated BARYONYX') { // Mutated BARYONYX 0.9x faster (90% speed increase) LK.setTimeout(function () { self.performCollection(); }, 30); // 0.1x delay = much faster mining } else if (selectedDinosaur === 'Mutated PARASAUROLUPHUS') { // Mutated PARASAUROLUPHUS is faster than regular PARASAUROLUPHUS - 2 second mining LK.setTimeout(function () { self.performCollection(); }, 2000); // 2 second delay - faster than regular PARASAUROLUPHUS } else { self.performCollection(); } }; self.performCollection = function () { self.isCollected = true; LK.getSound('dig').play(); // Animate collection tween(self, { scaleX: 0, scaleY: 0, alpha: 0 }, { duration: 300, easing: tween.easeIn, onFinish: function onFinish() { if (self.hasFossil) { currentLevel.revealFossil(self.fossilType, self.x, self.y); } currentLevel.checkBlockCollection(); } }); }; self.performTrexCollection = function () { // TREX breaks current block plus 4 surrounding blocks var blocksToBreak = [self]; var currentIndex = currentLevel.blocks.indexOf(self); if (currentIndex !== -1) { var blocksPerRow = 8; var row = Math.floor(currentIndex / blocksPerRow); var col = currentIndex % blocksPerRow; // Add surrounding blocks (up, down, left, right) var surroundingPositions = [{ row: row - 1, col: col }, // up { row: row + 1, col: col }, // down { row: row, col: col - 1 }, // left { row: row, col: col + 1 } // right ]; for (var i = 0; i < surroundingPositions.length; i++) { var pos = surroundingPositions[i]; if (pos.row >= 0 && pos.row < 6 && pos.col >= 0 && pos.col < blocksPerRow) { var blockIndex = pos.row * blocksPerRow + pos.col; if (blockIndex < currentLevel.blocks.length) { var block = currentLevel.blocks[blockIndex]; if (!block.isCollected) { blocksToBreak.push(block); } } } } } // Break all blocks for (var j = 0; j < blocksToBreak.length; j++) { blocksToBreak[j].performCollection(); } }; self.performSpinoCollection = function () { // SPINO tail strike breaks 3 blocks in a horizontal line var blocksToBreak = [self]; var currentIndex = currentLevel.blocks.indexOf(self); if (currentIndex !== -1) { var blocksPerRow = 8; var row = Math.floor(currentIndex / blocksPerRow); var col = currentIndex % blocksPerRow; // Add 2 blocks to the right for (var i = 1; i <= 2; i++) { if (col + i < blocksPerRow) { var blockIndex = row * blocksPerRow + (col + i); if (blockIndex < currentLevel.blocks.length) { var block = currentLevel.blocks[blockIndex]; if (!block.isCollected) { blocksToBreak.push(block); } } } } } // Break all blocks for (var j = 0; j < blocksToBreak.length; j++) { blocksToBreak[j].performCollection(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2F4F4F }); /**** * Game Code ****/ var gameState = 'nickname'; // 'nickname', 'playing' var playerNickname = storage.playerNickname || ''; var alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; var currentLetterIndex = 0; var currentLevelNumber = 1; var currentLevel = null; var levelTimer = 0; var leaderboardTexts = []; // Player data storage var playerCoins = storage.playerCoins || 0; var playerInventory = storage.playerInventory || []; var dinosaurCollection = storage.dinosaurCollection || []; var selectedDinosaur = storage.selectedDinosaur || null; var xrayLevelsLeft = storage.xrayLevelsLeft || 0; var doubleMoneyLevelsLeft = storage.doubleMoneyLevelsLeft || 0; var doubleValueActive = storage.doubleValueActive || false; var storageUpgradesBought = storage.storageUpgradesBought || 0; var fossilRarities = { 'fossil1': 'common', 'fossil2': 'common', 'fossil3': 'common', 'rareFossil': 'rare' }; var fossilValues = { 'fossil1': 10, 'fossil2': 15, 'fossil3': 20, 'rareFossil': 100 }; var dinosaurRarities = { 'PARASOUROLUPHUS': 'common', 'PYTHEREDON': 'common', 'DIMETRODON': 'common', 'BARYONYX': 'rare', 'ALLO': 'rare', 'YUTY': 'rare', 'TREX': 'legendary', 'SPINO': 'legendary', 'GIGA': 'legendary', 'Mutated BARYONYX': 'legendary', 'Mutated DIMETRODON': 'legendary', 'Mutated PARASAUROLUPHUS': 'legendary' }; // Dinosaur abilities var dinosaurAbilities = { 'PARASOUROLUPHUS': 'slow_dig', // Very slow, breaks 1 block at a time 'PYTHEREDON': 'single_fossil', // Collects only 1 fossil per level regardless of rarity 'DIMETRODON': 'fossil_collector', // Collects 2 fossils regardless of rarity 'BARYONYX': 'fast_dig_1', // 0.2x faster mining (20% speed increase) 'YUTY': 'fast_dig_2', // 0.7x faster mining (70% speed increase) 'ALLO': 'fast_dig_3', // 0.4x faster mining (40% speed increase) 'TREX': 'area_break', // Breaks 4 surrounding blocks, 3 uses per level 'SPINO': 'tail_strike', // Breaks 3 blocks in a line, 1 use per level 'GIGA': 'super_speed', // 2x mining speed increase 'Mutated BARYONYX': 'ultra_speed', // 0.9x faster mining (90% speed increase) 'Mutated DIMETRODON': 'top_collector', // Collects 3 most valuable fossils per level 'Mutated PARASAUROLUPHUS': 'slow_dig' // Same as regular PARASAUROLUPHUS - very slow mining }; // Dinosaur egg contents var commonEggDinosaurs = ['PARASOUROLUPHUS', 'PYTHEREDON', 'DIMETRODON']; var rareEggDinosaurs = [{ name: 'BARYONYX', chance: 0.45 }, { name: 'ALLO', chance: 0.35 }, { name: 'YUTY', chance: 0.20 }]; var legendaryEggDinosaurs = [{ name: 'TREX', chance: 0.03 }, { name: 'SPINO', chance: 0.10 }, { name: 'GIGA', chance: 0.15 }, { name: 'Mutated BARYONYX', chance: 0.25 }, { name: 'Mutated DIMETRODON', chance: 0.17 }, { name: 'Mutated PARASAUROLUPHUS', chance: 0.30 }]; function openEgg(eggType) { var dinosaurName = ''; if (eggType === 'common') { // Equal chance for all common dinosaurs dinosaurName = commonEggDinosaurs[Math.floor(Math.random() * commonEggDinosaurs.length)]; } else if (eggType === 'rare') { // Weighted random selection for rare dinosaurs var randomValue = Math.random(); var cumulativeChance = 0; for (var i = 0; i < rareEggDinosaurs.length; i++) { cumulativeChance += rareEggDinosaurs[i].chance; if (randomValue <= cumulativeChance) { dinosaurName = rareEggDinosaurs[i].name; break; } } } else if (eggType === 'legendary') { // Weighted random selection for legendary dinosaurs var randomValue = Math.random(); var cumulativeChance = 0; for (var i = 0; i < legendaryEggDinosaurs.length; i++) { cumulativeChance += legendaryEggDinosaurs[i].chance; if (randomValue <= cumulativeChance) { dinosaurName = legendaryEggDinosaurs[i].name; break; } } } // Add to dinosaur collection dinosaurCollection.push(dinosaurName); storage.dinosaurCollection = dinosaurCollection; return dinosaurName; } // UI Element arrays for different game states var menuUIElements = []; var gameUIElements = []; var storeUIElements = []; var sellUIElements = []; var bagUIElements = []; var infoUIElements = []; // UI Elements var nicknameText = new Text2('Enter Nickname: A', { size: 80, fill: '#FFFFFF' }); nicknameText.anchor.set(0.5, 0.5); nicknameText.x = 1024; nicknameText.y = 800; var instructionText = new Text2('Use arrows to select letters, ADD to add, DELETE to remove', { size: 45, fill: '#CCCCCC' }); instructionText.anchor.set(0.5, 0.5); instructionText.x = 1024; instructionText.y = 900; var scoreText = new Text2('Score: 0', { size: 60, fill: '#FFFFFF' }); scoreText.anchor.set(0, 0); var levelText = new Text2('Level: 1', { size: 60, fill: '#FFFFFF' }); levelText.anchor.set(1, 0); var timerText = new Text2('Time: 0', { size: 50, fill: '#FFFFFF' }); timerText.anchor.set(0.5, 0); // Nickname input elements var leftArrow = game.attachAsset('arrowLeft', { anchorX: 0.5, anchorY: 0.5 }); leftArrow.x = 800; leftArrow.y = 1000; var rightArrow = game.attachAsset('arrowRight', { anchorX: 0.5, anchorY: 0.5 }); rightArrow.x = 1248; rightArrow.y = 1000; var startButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); startButton.x = 1024; startButton.y = 1200; var startButtonText = new Text2('START', { size: 40, fill: '#FFFFFF' }); startButtonText.anchor.set(0.5, 0.5); startButtonText.x = 1024; startButtonText.y = 1200; var addButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); addButton.x = 900; addButton.y = 1100; var addButtonText = new Text2('ADD', { size: 35, fill: '#FFFFFF' }); addButtonText.anchor.set(0.5, 0.5); addButtonText.x = 900; addButtonText.y = 1100; var deleteButton = game.attachAsset('deleteButton', { anchorX: 0.5, anchorY: 0.5 }); deleteButton.x = 1148; deleteButton.y = 1100; var deleteButtonText = new Text2('DELETE', { size: 35, fill: '#FFFFFF' }); deleteButtonText.anchor.set(0.5, 0.5); deleteButtonText.x = 1148; deleteButtonText.y = 1100; var storeButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); storeButton.x = 700; storeButton.y = 1300; var storeButtonText = new Text2('STORE', { size: 35, fill: '#FFFFFF' }); storeButtonText.anchor.set(0.5, 0.5); storeButtonText.x = 700; storeButtonText.y = 1300; var sellButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); sellButton.x = 1348; sellButton.y = 1300; var sellButtonText = new Text2('SELL', { size: 35, fill: '#FFFFFF' }); sellButtonText.anchor.set(0.5, 0.5); sellButtonText.x = 1348; sellButtonText.y = 1300; var shopButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); shopButton.x = 1024; shopButton.y = 1500; var shopButtonText = new Text2('SHOP', { size: 35, fill: '#FFFFFF' }); shopButtonText.anchor.set(0.5, 0.5); shopButtonText.x = 1024; shopButtonText.y = 1500; var bagButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); bagButton.x = 1024; bagButton.y = 1600; var bagButtonText = new Text2('BAG', { size: 35, fill: '#FFFFFF' }); bagButtonText.anchor.set(0.5, 0.5); bagButtonText.x = 1024; bagButtonText.y = 1600; var coinsText = new Text2('Coins: ' + playerCoins, { size: 50, fill: '#FFD700' }); coinsText.anchor.set(0.5, 0.5); coinsText.x = 1024; coinsText.y = 1400; // Add nickname UI to game and track as menu elements game.addChild(nicknameText); game.addChild(instructionText); game.addChild(leftArrow); game.addChild(rightArrow); game.addChild(addButton); game.addChild(addButtonText); game.addChild(deleteButton); game.addChild(deleteButtonText); game.addChild(startButton); game.addChild(startButtonText); game.addChild(storeButton); game.addChild(storeButtonText); game.addChild(sellButton); game.addChild(sellButtonText); game.addChild(shopButton); game.addChild(shopButtonText); game.addChild(bagButton); game.addChild(bagButtonText); game.addChild(coinsText); // Track menu UI elements menuUIElements.push(nicknameText, instructionText, leftArrow, rightArrow, addButton, addButtonText, deleteButton, deleteButtonText, startButton, startButtonText, storeButton, storeButtonText, sellButton, sellButtonText, shopButton, shopButtonText, bagButton, bagButtonText, coinsText); // Track game UI elements gameUIElements.push(scoreText, levelText, timerText); // Add game UI to GUI LK.gui.topLeft.addChild(scoreText); scoreText.x = 120; scoreText.y = 20; scoreText.visible = false; LK.gui.topRight.addChild(levelText); levelText.y = 20; levelText.visible = false; LK.gui.top.addChild(timerText); timerText.y = 100; timerText.visible = false; function hideAllMenuUI() { for (var i = 0; i < menuUIElements.length; i++) { menuUIElements[i].visible = false; } } function showAllMenuUI() { for (var i = 0; i < menuUIElements.length; i++) { menuUIElements[i].visible = true; } } function hideAllGameUI() { for (var i = 0; i < gameUIElements.length; i++) { gameUIElements[i].visible = false; } } function showAllGameUI() { for (var i = 0; i < gameUIElements.length; i++) { gameUIElements[i].visible = true; } } function hideAllStoreUI() { for (var i = 0; i < storeUIElements.length; i++) { storeUIElements[i].destroy(); } storeUIElements = []; } function hideAllSellUI() { for (var i = 0; i < sellUIElements.length; i++) { sellUIElements[i].destroy(); } sellUIElements = []; } function hideAllBagUI() { for (var i = 0; i < bagUIElements.length; i++) { bagUIElements[i].destroy(); } bagUIElements = []; } function hideAllInfoUI() { for (var i = 0; i < infoUIElements.length; i++) { infoUIElements[i].destroy(); } infoUIElements = []; } function updateNicknameDisplay() { var displayText = 'Enter Nickname: ' + playerNickname + alphabet[currentLetterIndex]; nicknameText.setText(displayText); } function startLevel(levelNumber) { // Clean up previous level if (currentLevel) { currentLevel.destroy(); } currentLevelNumber = levelNumber; levelTimer = 0; // Reset PYTHEREDON fossil counter for new level if (selectedDinosaur === 'PYTHEREDON') { storage.fossilsCollectedByPytheredon = 0; } // Reset legendary dinosaur ability counters for new level if (selectedDinosaur === 'TREX') { storage.trexUsesLeft = 3; } if (selectedDinosaur === 'SPINO') { storage.spinoUsesLeft = 1; } // Create new level currentLevel = new Level(levelNumber); currentLevel.createLevel(); game.addChild(currentLevel); levelText.setText('Level: ' + levelNumber); } function showStore() { gameState = 'store'; // Hide all menu and game UI elements hideAllMenuUI(); hideAllGameUI(); // Create store display var storeTitle = new Text2('FOSSIL STORE', { size: 80, fill: '#FFFFFF' }); storeTitle.anchor.set(0.5, 0.5); storeTitle.x = 1024; storeTitle.y = 200; game.addChild(storeTitle); storeUIElements.push(storeTitle); var backButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); backButton.x = 1024; backButton.y = 1500; var backButtonText = new Text2('BACK', { size: 35, fill: '#FFFFFF' }); backButtonText.anchor.set(0.5, 0.5); backButtonText.x = 1024; backButtonText.y = 1500; game.addChild(backButtonText); storeUIElements.push(backButton, backButtonText); // Sort and display inventory by rarity var rareFossils = []; var commonFossils = []; for (var i = 0; i < playerInventory.length; i++) { if (fossilRarities[playerInventory[i]] === 'rare') { rareFossils.push(playerInventory[i]); } else { commonFossils.push(playerInventory[i]); } } var allFossils = rareFossils.concat(commonFossils); var startY = 350; for (var j = 0; j < allFossils.length && j < 10; j++) { var fossilName = allFossils[j]; var rarity = fossilRarities[fossilName]; var color = rarity === 'rare' ? '#FFD700' : '#FFFFFF'; var fossilText = new Text2(fossilName + ' (' + rarity + ')', { size: 40, fill: color }); fossilText.anchor.set(0.5, 0.5); fossilText.x = 1024; fossilText.y = startY + j * 60; game.addChild(fossilText); storeUIElements.push(fossilText); } backButton.down = function () { hideStore(); }; } function hideStore() { gameState = 'nickname'; // Remove all store UI elements hideAllStoreUI(); // Restore menu UI elements showAllMenuUI(); } function showSell() { gameState = 'sell'; // Hide all menu and game UI elements hideAllMenuUI(); hideAllGameUI(); // Create sell display var sellTitle = new Text2('SELL FOSSILS', { size: 80, fill: '#FFFFFF' }); sellTitle.anchor.set(0.5, 0.5); sellTitle.x = 1024; sellTitle.y = 200; game.addChild(sellTitle); sellUIElements.push(sellTitle); var sellAllButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); sellAllButton.x = 1024; sellAllButton.y = 1400; var sellAllButtonText = new Text2('SELL ALL', { size: 35, fill: '#FFFFFF' }); sellAllButtonText.anchor.set(0.5, 0.5); sellAllButtonText.x = 1024; sellAllButtonText.y = 1400; game.addChild(sellAllButtonText); sellUIElements.push(sellAllButton, sellAllButtonText); var sellBackButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); sellBackButton.x = 1024; sellBackButton.y = 1500; var sellBackButtonText = new Text2('BACK', { size: 35, fill: '#FFFFFF' }); sellBackButtonText.anchor.set(0.5, 0.5); sellBackButtonText.x = 1024; sellBackButtonText.y = 1500; game.addChild(sellBackButtonText); sellUIElements.push(sellBackButton, sellBackButtonText); // Calculate total value var totalValue = 0; for (var i = 0; i < playerInventory.length; i++) { var fossilValue = fossilValues[playerInventory[i]]; if (doubleValueActive) { fossilValue *= 2; } totalValue += fossilValue; } var totalValueText = new Text2('Total Value: ' + totalValue + ' coins', { size: 50, fill: '#FFD700' }); totalValueText.anchor.set(0.5, 0.5); totalValueText.x = 1024; totalValueText.y = 300; game.addChild(totalValueText); sellUIElements.push(totalValueText); sellAllButton.down = function () { playerCoins += totalValue; playerInventory = []; // Reset 2X VALUE effect after use if (doubleValueActive) { doubleValueActive = false; storage.doubleValueActive = doubleValueActive; } storage.playerCoins = playerCoins; storage.playerInventory = playerInventory; hideSell(); }; sellBackButton.down = function () { hideSell(); }; } function hideSell() { gameState = 'nickname'; // Remove all sell UI elements hideAllSellUI(); // Restore menu UI elements showAllMenuUI(); coinsText.setText('Coins: ' + playerCoins); } function showShop() { gameState = 'shop'; // Hide all menu and game UI elements hideAllMenuUI(); hideAllGameUI(); // Create shop display var shopTitle = new Text2('POWER-UP SHOP', { size: 80, fill: '#FFFFFF' }); shopTitle.anchor.set(0.5, 0.5); shopTitle.x = 1024; shopTitle.y = 200; game.addChild(shopTitle); storeUIElements.push(shopTitle); // XRAY Power-up var xrayButton = game.attachAsset('purchaseButton', { anchorX: 0.5, anchorY: 0.5 }); xrayButton.x = 1024; xrayButton.y = 400; var xrayText = new Text2('XRAY - 500 Coins\nReveals all fossils for 1 level', { size: 35, fill: '#FFFFFF' }); xrayText.anchor.set(0.5, 0.5); xrayText.x = 1024; xrayText.y = 400; // 2X MONEY Power-up var doubleMoneyButton = game.attachAsset('purchaseButton', { anchorX: 0.5, anchorY: 0.5 }); doubleMoneyButton.x = 1024; doubleMoneyButton.y = 550; var doubleMoneyText = new Text2('2X MONEY - 10000 Coins\nDouble money for 20 levels', { size: 35, fill: '#FFFFFF' }); doubleMoneyText.anchor.set(0.5, 0.5); doubleMoneyText.x = 1024; doubleMoneyText.y = 550; // 2X VALUE Power-up var doubleValueButton = game.attachAsset('purchaseButton', { anchorX: 0.5, anchorY: 0.5 }); doubleValueButton.x = 1024; doubleValueButton.y = 700; var doubleValueText = new Text2('2X LUCK - 1250 Coins\nDouble sell value (one time)', { size: 35, fill: '#FFFFFF' }); doubleValueText.anchor.set(0.5, 0.5); doubleValueText.x = 1024; doubleValueText.y = 700; // +1 STORAGE Power-up var storageButton = game.attachAsset('purchaseButton', { anchorX: 0.5, anchorY: 0.5 }); storageButton.x = 1024; storageButton.y = 850; var storageUpgradesBought = storage.storageUpgradesBought || 0; var storageText = new Text2('+1 STORAGE - 100000 Coins\nAdd 1 dinosaur slot (' + storageUpgradesBought + '/4)', { size: 35, fill: '#FFFFFF' }); storageText.anchor.set(0.5, 0.5); storageText.x = 1024; storageText.y = 850; // Common Egg var commonEggButton = game.attachAsset('purchaseButton', { anchorX: 0.5, anchorY: 0.5 }); commonEggButton.x = 1024; commonEggButton.y = 1400; var commonEggText = new Text2('Sıradan Yumurta - 500 Coins\nCommon fossil guaranteed', { size: 35, fill: '#FFFFFF' }); commonEggText.anchor.set(0.5, 0.5); commonEggText.x = 1024; commonEggText.y = 1400; // Common Egg Info Button var commonEggInfoButton = new Text2('❗', { size: 60, fill: '#FFD700' }); commonEggInfoButton.anchor.set(0.5, 0.5); commonEggInfoButton.x = 1350; commonEggInfoButton.y = 1400; game.addChild(commonEggInfoButton); // Rare Egg var rareEggButton = game.attachAsset('purchaseButton', { anchorX: 0.5, anchorY: 0.5 }); rareEggButton.x = 1024; rareEggButton.y = 1550; var rareEggText = new Text2('Nadir Yumurta - 2000 Coins\nRare fossil guaranteed', { size: 35, fill: '#FFD700' }); rareEggText.anchor.set(0.5, 0.5); rareEggText.x = 1024; rareEggText.y = 1550; // Rare Egg Info Button var rareEggInfoButton = new Text2('❗', { size: 60, fill: '#FFD700' }); rareEggInfoButton.anchor.set(0.5, 0.5); rareEggInfoButton.x = 1350; rareEggInfoButton.y = 1550; game.addChild(rareEggInfoButton); // Legendary Egg var legendaryEggButton = game.attachAsset('purchaseButton', { anchorX: 0.5, anchorY: 0.5 }); legendaryEggButton.x = 1024; legendaryEggButton.y = 1700; var legendaryEggText = new Text2('Destansı Yumurta - 10000 Coins\nLegendary fossil guaranteed', { size: 35, fill: '#FF69B4' }); legendaryEggText.anchor.set(0.5, 0.5); legendaryEggText.x = 1024; legendaryEggText.y = 1700; // Legendary Egg Info Button var legendaryEggInfoButton = new Text2('❗', { size: 60, fill: '#FFD700' }); legendaryEggInfoButton.anchor.set(0.5, 0.5); legendaryEggInfoButton.x = 1350; legendaryEggInfoButton.y = 1700; game.addChild(legendaryEggInfoButton); // Back button var shopBackButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); shopBackButton.x = 1024; shopBackButton.y = 1200; var shopBackButtonText = new Text2('BACK', { size: 35, fill: '#FFFFFF' }); shopBackButtonText.anchor.set(0.5, 0.5); shopBackButtonText.x = 1024; shopBackButtonText.y = 1200; game.addChild(xrayText); game.addChild(doubleMoneyText); game.addChild(doubleValueText); game.addChild(commonEggText); game.addChild(rareEggText); game.addChild(legendaryEggText); game.addChild(shopBackButtonText); game.addChild(storageText); storeUIElements.push(xrayButton, xrayText, doubleMoneyButton, doubleMoneyText, doubleValueButton, doubleValueText, storageButton, storageText, commonEggButton, commonEggText, commonEggInfoButton, rareEggButton, rareEggText, rareEggInfoButton, legendaryEggButton, legendaryEggText, legendaryEggInfoButton, shopBackButton, shopBackButtonText); // Purchase handlers xrayButton.down = function () { if (playerCoins >= 500) { playerCoins -= 500; xrayLevelsLeft++; storage.playerCoins = playerCoins; storage.xrayLevelsLeft = xrayLevelsLeft; hideShop(); } }; doubleMoneyButton.down = function () { if (playerCoins >= 10000) { playerCoins -= 10000; doubleMoneyLevelsLeft += 20; storage.playerCoins = playerCoins; storage.doubleMoneyLevelsLeft = doubleMoneyLevelsLeft; hideShop(); } }; doubleValueButton.down = function () { if (playerCoins >= 1250) { playerCoins -= 1250; doubleValueActive = true; storage.playerCoins = playerCoins; storage.doubleValueActive = doubleValueActive; hideShop(); } }; storageButton.down = function () { var storageUpgradesBought = storage.storageUpgradesBought || 0; if (playerCoins >= 100000 && storageUpgradesBought < 4) { playerCoins -= 100000; storageUpgradesBought++; storage.playerCoins = playerCoins; storage.storageUpgradesBought = storageUpgradesBought; hideShop(); } }; // Common egg info handler commonEggInfoButton.down = function () { showCommonEggInfo(); }; // Egg purchase handlers commonEggButton.down = function () { if (playerCoins >= 500) { playerCoins -= 500; // Open common egg and get dinosaur var dinosaurName = openEgg('common'); storage.playerCoins = playerCoins; hideShop(); } }; // Rare egg info handler rareEggInfoButton.down = function () { showRareEggInfo(); }; rareEggButton.down = function () { if (playerCoins >= 2000) { playerCoins -= 2000; // Open rare egg and get dinosaur var dinosaurName = openEgg('rare'); storage.playerCoins = playerCoins; hideShop(); } }; // Legendary egg info handler legendaryEggInfoButton.down = function () { showLegendaryEggInfo(); }; legendaryEggButton.down = function () { if (playerCoins >= 10000) { playerCoins -= 10000; // Open legendary egg and get dinosaur var dinosaurName = openEgg('legendary'); storage.playerCoins = playerCoins; hideShop(); } }; shopBackButton.down = function () { hideShop(); }; } function hideShop() { gameState = 'nickname'; // Remove all shop UI elements hideAllStoreUI(); // Restore menu UI elements showAllMenuUI(); coinsText.setText('Coins: ' + playerCoins); } function showBag() { gameState = 'bag'; // Hide all menu and game UI elements hideAllMenuUI(); hideAllGameUI(); // Create bag display var bagTitle = new Text2('DINOSAUR BAG', { size: 80, fill: '#FFFFFF' }); bagTitle.anchor.set(0.5, 0.5); bagTitle.x = 1024; bagTitle.y = 200; game.addChild(bagTitle); bagUIElements.push(bagTitle); // Sort dinosaurs by rarity var legendaryDinos = []; var rareDinos = []; var commonDinos = []; for (var i = 0; i < dinosaurCollection.length; i++) { var dino = dinosaurCollection[i]; var rarity = dinosaurRarities[dino]; if (rarity === 'legendary') { legendaryDinos.push(dino); } else if (rarity === 'rare') { rareDinos.push(dino); } else { commonDinos.push(dino); } } var allDinos = legendaryDinos.concat(rareDinos).concat(commonDinos); // Display dinosaurs with selection - max slots based on storage upgrades (1 base + upgrades, max 5) var maxSlots = Math.min(5, 1 + storageUpgradesBought); var startY = 350; for (var j = 0; j < allDinos.length && j < maxSlots; j++) { var dinoName = allDinos[j]; var rarity = dinosaurRarities[dinoName]; var color = '#FFFFFF'; if (rarity === 'legendary') color = '#FF69B4';else if (rarity === 'rare') color = '#FFD700'; var isSelected = selectedDinosaur === dinoName; var displayText = dinoName + ' (' + rarity + ')' + (isSelected ? ' [SELECTED]' : ''); var dinoButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); dinoButton.x = 1024; dinoButton.y = startY + j * 80; var dinoText = new Text2(displayText, { size: 35, fill: color }); dinoText.anchor.set(0.5, 0.5); dinoText.x = 1024; dinoText.y = startY + j * 80; game.addChild(dinoText); bagUIElements.push(dinoButton, dinoText); // Create closure for selection (function (dinosaurName) { dinoButton.down = function () { selectedDinosaur = dinosaurName; storage.selectedDinosaur = selectedDinosaur; hideBag(); }; })(dinoName); } // Back button var bagBackButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); bagBackButton.x = 1024; bagBackButton.y = 1500; var bagBackButtonText = new Text2('BACK', { size: 35, fill: '#FFFFFF' }); bagBackButtonText.anchor.set(0.5, 0.5); bagBackButtonText.x = 1024; bagBackButtonText.y = 1500; game.addChild(bagBackButtonText); bagUIElements.push(bagBackButton, bagBackButtonText); bagBackButton.down = function () { hideBag(); }; } function hideBag() { gameState = 'nickname'; // Remove all bag UI elements hideAllBagUI(); // Restore menu UI elements showAllMenuUI(); } function showCommonEggInfo() { gameState = 'commonEggInfo'; // Hide all shop UI elements hideAllStoreUI(); // Create info display var infoTitle = new Text2('SIRADAN YUMURTA İÇERİĞİ', { size: 60, fill: '#FFFFFF' }); infoTitle.anchor.set(0.5, 0.5); infoTitle.x = 1024; infoTitle.y = 200; game.addChild(infoTitle); infoUIElements.push(infoTitle); var infoText = 'PARASOUROLUPHUS - %33.33\n'; infoText += 'Yavaş kazma (1 saniye gecikme)\n\n'; infoText += 'PYTHEREDON - %33.33\n'; infoText += 'Seviye başı sadece 1 fosil alır\n\n'; infoText += 'DIMETRODON - %33.33\n'; infoText += 'Nadirlık fark etmez 2 fosil alır'; var infoDisplay = new Text2(infoText, { size: 40, fill: '#FFFFFF' }); infoDisplay.anchor.set(0.5, 0.5); infoDisplay.x = 1024; infoDisplay.y = 600; game.addChild(infoDisplay); infoUIElements.push(infoDisplay); var backButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); backButton.x = 1024; backButton.y = 1200; var backButtonText = new Text2('BACK', { size: 35, fill: '#FFFFFF' }); backButtonText.anchor.set(0.5, 0.5); backButtonText.x = 1024; backButtonText.y = 1200; game.addChild(backButtonText); infoUIElements.push(backButton, backButtonText); backButton.down = function () { hideInfoScreen(); showShop(); }; } function showRareEggInfo() { gameState = 'rareEggInfo'; // Hide all shop UI elements hideAllStoreUI(); // Create info display var infoTitle = new Text2('NADİR YUMURTA İÇERİĞİ', { size: 60, fill: '#FFFFFF' }); infoTitle.anchor.set(0.5, 0.5); infoTitle.x = 1024; infoTitle.y = 200; game.addChild(infoTitle); infoUIElements.push(infoTitle); var infoText = 'BARYONYX - %45\n'; infoText += '0.2x daha hızlı kaya kazma\n\n'; infoText += 'ALLO - %35\n'; infoText += '0.4x daha hızlı kaya kazma\n\n'; infoText += 'YUTY - %20\n'; infoText += '0.7x daha hızlı kaya kazma'; var infoDisplay = new Text2(infoText, { size: 40, fill: '#FFFFFF' }); infoDisplay.anchor.set(0.5, 0.5); infoDisplay.x = 1024; infoDisplay.y = 600; game.addChild(infoDisplay); infoUIElements.push(infoDisplay); var backButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); backButton.x = 1024; backButton.y = 1200; var backButtonText = new Text2('BACK', { size: 35, fill: '#FFFFFF' }); backButtonText.anchor.set(0.5, 0.5); backButtonText.x = 1024; backButtonText.y = 1200; game.addChild(backButtonText); infoUIElements.push(backButton, backButtonText); backButton.down = function () { hideInfoScreen(); showShop(); }; } function showLegendaryEggInfo() { gameState = 'legendaryEggInfo'; // Hide all shop UI elements hideAllStoreUI(); // Create info display var infoTitle = new Text2('DESTANSI YUMURTA İÇERİĞİ', { size: 60, fill: '#FFFFFF' }); infoTitle.anchor.set(0.5, 0.5); infoTitle.x = 1024; infoTitle.y = 200; game.addChild(infoTitle); infoUIElements.push(infoTitle); var infoText = 'TREX - %3\n'; infoText += 'Etraftaki 4 kayayı kırar (3 kullanım)\n\n'; infoText += 'SPINO - %10\n'; infoText += 'Kuyruk darbesi 3 kaya kırar (1 kullanım)\n\n'; infoText += 'GIGA - %15\n'; infoText += 'Kaya kırma hızı 2x artar\n\n'; infoText += 'Mutasyonlu BARYONYX - %25\n'; infoText += 'Kaya kırma 0.9x daha hızlı\n\n'; infoText += 'Mutasyonlu DIMETRODON - %17\n'; infoText += 'En değerli 3 fosili alır\n\n'; infoText += 'Mutasyonlu PARASAUROLUPHUS - %30\n'; infoText += 'Hızlı blok kırma (2 saniye)'; var infoDisplay = new Text2(infoText, { size: 30, fill: '#FFFFFF' }); infoDisplay.anchor.set(0.5, 0.5); infoDisplay.x = 1024; infoDisplay.y = 700; game.addChild(infoDisplay); infoUIElements.push(infoDisplay); var backButton = game.attachAsset('startButton', { anchorX: 0.5, anchorY: 0.5 }); backButton.x = 1024; backButton.y = 1200; var backButtonText = new Text2('BACK', { size: 35, fill: '#FFFFFF' }); backButtonText.anchor.set(0.5, 0.5); backButtonText.x = 1024; backButtonText.y = 1200; game.addChild(backButtonText); infoUIElements.push(backButton, backButtonText); backButton.down = function () { hideInfoScreen(); showShop(); }; } function hideInfoScreen() { // Remove all info UI elements hideAllInfoUI(); } function startGame() { if (playerNickname.length === 0) { return; } storage.playerNickname = playerNickname; gameState = 'playing'; // Hide menu UI elements hideAllMenuUI(); // Show game UI elements timerText.visible = true; scoreText.visible = true; levelText.visible = true; // Show power-up purchase options purchaseOption1.visible = true; purchaseText1.visible = true; purchaseOption2.visible = true; purchaseText2.visible = true; purchaseOption3.visible = true; purchaseText3.visible = true; // Start first level startLevel(1); } // Event handlers leftArrow.down = function (x, y, obj) { if (gameState !== 'nickname') { return; } currentLetterIndex = (currentLetterIndex - 1 + alphabet.length) % alphabet.length; updateNicknameDisplay(); }; rightArrow.down = function (x, y, obj) { if (gameState !== 'nickname') { return; } currentLetterIndex = (currentLetterIndex + 1) % alphabet.length; updateNicknameDisplay(); }; addButton.down = function (x, y, obj) { if (gameState !== 'nickname') { return; } // Add current letter to nickname if (playerNickname.length < 12) { playerNickname += alphabet[currentLetterIndex]; updateNicknameDisplay(); } }; startButton.down = function (x, y, obj) { if (gameState !== 'nickname') { return; } startGame(); }; deleteButton.down = function (x, y, obj) { if (gameState !== 'nickname') { return; } if (playerNickname.length > 0) { playerNickname = playerNickname.slice(0, -1); updateNicknameDisplay(); } }; storeButton.down = function (x, y, obj) { if (gameState !== 'nickname') { return; } showStore(); }; sellButton.down = function (x, y, obj) { if (gameState !== 'nickname') { return; } showSell(); }; shopButton.down = function (x, y, obj) { if (gameState !== 'nickname') { return; } showShop(); }; bagButton.down = function (x, y, obj) { if (gameState !== 'nickname') { return; } showBag(); }; game.down = function (x, y, obj) { // Game down handler for playing state only }; // Game update loop game.update = function () { if (gameState === 'playing') { levelTimer++; timerText.setText('Time: ' + Math.floor(levelTimer / 60)); // Slowly decrease score over time to encourage speed if (levelTimer % 120 === 0 && LK.getScore() > 0) { // Every 2 seconds LK.setScore(Math.max(0, LK.getScore() - 1)); scoreText.setText('Score: ' + LK.getScore()); } } }; // Power-up purchase options (shown when game is playing) var purchaseOption1 = game.attachAsset('purchaseButton', { anchorX: 0.5, anchorY: 0.5 }); purchaseOption1.x = 1800; purchaseOption1.y = 400; purchaseOption1.visible = false; var purchaseText1 = new Text2('XRAY\n500 Coins', { size: 30, fill: '#FFFFFF' }); purchaseText1.anchor.set(0.5, 0.5); purchaseText1.x = 1800; purchaseText1.y = 400; purchaseText1.visible = false; game.addChild(purchaseText1); var purchaseOption2 = game.attachAsset('purchaseButton', { anchorX: 0.5, anchorY: 0.5 }); purchaseOption2.x = 1800; purchaseOption2.y = 520; purchaseOption2.visible = false; var purchaseText2 = new Text2('2X MONEY\n10000 Coins', { size: 30, fill: '#FFFFFF' }); purchaseText2.anchor.set(0.5, 0.5); purchaseText2.x = 1800; purchaseText2.y = 520; purchaseText2.visible = false; game.addChild(purchaseText2); var purchaseOption3 = game.attachAsset('purchaseButton', { anchorX: 0.5, anchorY: 0.5 }); purchaseOption3.x = 1800; purchaseOption3.y = 640; purchaseOption3.visible = false; var purchaseText3 = new Text2('2X LUCK\n1250 Coins', { size: 30, fill: '#FFFFFF' }); purchaseText3.anchor.set(0.5, 0.5); purchaseText3.x = 1800; purchaseText3.y = 640; purchaseText3.visible = false; game.addChild(purchaseText3); // Track purchase UI elements as game UI gameUIElements.push(purchaseOption1, purchaseText1, purchaseOption2, purchaseText2, purchaseOption3, purchaseText3); // Purchase event handlers purchaseOption1.down = function (x, y, obj) { if (gameState === 'playing' && playerCoins >= 500) { playerCoins -= 500; xrayLevelsLeft = 1; storage.playerCoins = playerCoins; storage.xrayLevelsLeft = xrayLevelsLeft; coinsText.setText('Coins: ' + playerCoins); // Show all fossils for current level if (currentLevel) { for (var i = 0; i < currentLevel.blocks.length; i++) { var block = currentLevel.blocks[i]; if (block.hasFossil && !block.isCollected) { block.alpha = 0.5; // Make blocks with fossils semi-transparent } } } } }; purchaseOption2.down = function (x, y, obj) { if (gameState === 'playing' && playerCoins >= 10000) { playerCoins -= 10000; doubleMoneyLevelsLeft = 20; storage.playerCoins = playerCoins; storage.doubleMoneyLevelsLeft = doubleMoneyLevelsLeft; coinsText.setText('Coins: ' + playerCoins); } }; purchaseOption3.down = function (x, y, obj) { if (gameState === 'playing' && playerCoins >= 1250) { playerCoins -= 1250; doubleValueActive = true; storage.playerCoins = playerCoins; storage.doubleValueActive = doubleValueActive; coinsText.setText('Coins: ' + playerCoins); } }; // Initialize display updateNicknameDisplay(); coinsText.setText('Coins: ' + playerCoins);
===================================================================
--- original.js
+++ change.js
@@ -435,8 +435,9 @@
var selectedDinosaur = storage.selectedDinosaur || null;
var xrayLevelsLeft = storage.xrayLevelsLeft || 0;
var doubleMoneyLevelsLeft = storage.doubleMoneyLevelsLeft || 0;
var doubleValueActive = storage.doubleValueActive || false;
+var storageUpgradesBought = storage.storageUpgradesBought || 0;
var fossilRarities = {
'fossil1': 'common',
'fossil2': 'common',
'fossil3': 'common',
@@ -1018,8 +1019,23 @@
});
doubleValueText.anchor.set(0.5, 0.5);
doubleValueText.x = 1024;
doubleValueText.y = 700;
+ // +1 STORAGE Power-up
+ var storageButton = game.attachAsset('purchaseButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ storageButton.x = 1024;
+ storageButton.y = 850;
+ var storageUpgradesBought = storage.storageUpgradesBought || 0;
+ var storageText = new Text2('+1 STORAGE - 100000 Coins\nAdd 1 dinosaur slot (' + storageUpgradesBought + '/4)', {
+ size: 35,
+ fill: '#FFFFFF'
+ });
+ storageText.anchor.set(0.5, 0.5);
+ storageText.x = 1024;
+ storageText.y = 850;
// Common Egg
var commonEggButton = game.attachAsset('purchaseButton', {
anchorX: 0.5,
anchorY: 0.5
@@ -1108,9 +1124,10 @@
game.addChild(commonEggText);
game.addChild(rareEggText);
game.addChild(legendaryEggText);
game.addChild(shopBackButtonText);
- storeUIElements.push(xrayButton, xrayText, doubleMoneyButton, doubleMoneyText, doubleValueButton, doubleValueText, commonEggButton, commonEggText, commonEggInfoButton, rareEggButton, rareEggText, rareEggInfoButton, legendaryEggButton, legendaryEggText, legendaryEggInfoButton, shopBackButton, shopBackButtonText);
+ game.addChild(storageText);
+ storeUIElements.push(xrayButton, xrayText, doubleMoneyButton, doubleMoneyText, doubleValueButton, doubleValueText, storageButton, storageText, commonEggButton, commonEggText, commonEggInfoButton, rareEggButton, rareEggText, rareEggInfoButton, legendaryEggButton, legendaryEggText, legendaryEggInfoButton, shopBackButton, shopBackButtonText);
// Purchase handlers
xrayButton.down = function () {
if (playerCoins >= 500) {
playerCoins -= 500;
@@ -1137,8 +1154,18 @@
storage.doubleValueActive = doubleValueActive;
hideShop();
}
};
+ storageButton.down = function () {
+ var storageUpgradesBought = storage.storageUpgradesBought || 0;
+ if (playerCoins >= 100000 && storageUpgradesBought < 4) {
+ playerCoins -= 100000;
+ storageUpgradesBought++;
+ storage.playerCoins = playerCoins;
+ storage.storageUpgradesBought = storageUpgradesBought;
+ hideShop();
+ }
+ };
// Common egg info handler
commonEggInfoButton.down = function () {
showCommonEggInfo();
};
@@ -1220,11 +1247,12 @@
commonDinos.push(dino);
}
}
var allDinos = legendaryDinos.concat(rareDinos).concat(commonDinos);
- // Display dinosaurs with selection
+ // Display dinosaurs with selection - max slots based on storage upgrades (1 base + upgrades, max 5)
+ var maxSlots = Math.min(5, 1 + storageUpgradesBought);
var startY = 350;
- for (var j = 0; j < allDinos.length && j < 10; j++) {
+ for (var j = 0; j < allDinos.length && j < maxSlots; j++) {
var dinoName = allDinos[j];
var rarity = dinosaurRarities[dinoName];
var color = '#FFFFFF';
if (rarity === 'legendary') color = '#FF69B4';else if (rarity === 'rare') color = '#FFD700';