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(); // 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; LK.setScore(LK.getScore() + totalPoints); scoreText.setText('Score: ' + LK.getScore()); // 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()); // 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 () { 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(); } }); }; 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 fossilRarities = { 'fossil1': 'common', 'fossil2': 'common', 'fossil3': 'common', 'rareFossil': 'rare' }; var fossilValues = { 'fossil1': 10, 'fossil2': 15, 'fossil3': 20, 'rareFossil': 100 }; // UI Element arrays for different game states var menuUIElements = []; var gameUIElements = []; var storeUIElements = []; var sellUIElements = []; // 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 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(coinsText); // Track menu UI elements menuUIElements.push(nicknameText, instructionText, leftArrow, rightArrow, addButton, addButtonText, deleteButton, deleteButtonText, startButton, startButtonText, storeButton, storeButtonText, sellButton, sellButtonText, 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 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; // 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++) { totalValue += fossilValues[playerInventory[i]]; } 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 = []; 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 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; // 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(); }; 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()); } } }; // Money 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('50 Coins\n$1.99', { 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('150 Coins\n$4.99', { 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('500 Coins\n$14.99', { 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 += 50; storage.playerCoins = playerCoins; coinsText.setText('Coins: ' + playerCoins); } }; purchaseOption2.down = function (x, y, obj) { if (gameState === 'playing') { playerCoins += 150; storage.playerCoins = playerCoins; coinsText.setText('Coins: ' + playerCoins); } }; purchaseOption3.down = function (x, y, obj) { if (gameState === 'playing') { playerCoins += 500; storage.playerCoins = playerCoins; coinsText.setText('Coins: ' + playerCoins); } }; // Initialize display updateNicknameDisplay(); coinsText.setText('Coins: ' + playerCoins);
===================================================================
--- original.js
+++ change.js
@@ -653,7 +653,80 @@
scoreText.setText('Score: ' + LK.getScore());
}
}
};
+// Money 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('50 Coins\n$1.99', {
+ 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('150 Coins\n$4.99', {
+ 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('500 Coins\n$14.99', {
+ 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 += 50;
+ storage.playerCoins = playerCoins;
+ coinsText.setText('Coins: ' + playerCoins);
+ }
+};
+purchaseOption2.down = function (x, y, obj) {
+ if (gameState === 'playing') {
+ playerCoins += 150;
+ storage.playerCoins = playerCoins;
+ coinsText.setText('Coins: ' + playerCoins);
+ }
+};
+purchaseOption3.down = function (x, y, obj) {
+ if (gameState === 'playing') {
+ playerCoins += 500;
+ storage.playerCoins = playerCoins;
+ coinsText.setText('Coins: ' + playerCoins);
+ }
+};
// Initialize display
updateNicknameDisplay();
coinsText.setText('Coins: ' + playerCoins);
\ No newline at end of file