User prompt
haz que el nivel maximo del bot sea 20 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
crea un boton para subir el nivel del bot y mientras mayor sea el nivel del bot menos tiempo durara para hacer click a la roca ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
haz que el tamaño de la roca no aumente por cada nivel
User prompt
a partir del nivel 5 poner un boton para activar el bot que haga click automaticamente a la roca cada 2 segundos
User prompt
crea 4 evoluciones de roca mas
User prompt
cada vez que evolucione la roca aumenta la cantidad de todos los materiales
User prompt
haz que puedas obtener mas de un material
User prompt
crea un boton para reinicial el progreso ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
haz que cada nivel de roca te de un material diferente
User prompt
en cada nivel de la roca da mas materiales
User prompt
al habrir el menu de updates que vaya a la capa delantera
User prompt
crea asets para los niveles de la roca
User prompt
elimina la funcion de que los materiales se vendadn automaticamente
User prompt
agrega un boton para vender los materiales
User prompt
agrega un boton en upgrades para evolucionar la roca
Code edit (1 edits merged)
Please save this source code
User prompt
Rock Miner Clicker
Initial prompt
crea un juego en el que al hacer click en una roca obtengas materiales que puedes vender a cambio de monedas que puedes utilizar para mejorar la roca
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { coins: 0, materialPerClick: 1, coinValue: 1, clickUpgradeCost: 10, valueUpgradeCost: 50, clickUpgradeLevel: 0, valueUpgradeLevel: 0, evolutionUpgradeCost: 100, evolutionLevel: 0 }); /**** * Classes ****/ var CoinParticle = Container.expand(function () { var self = Container.call(this); var coin = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.init = function (startX, startY) { self.x = startX; self.y = startY; // Animate coin floating up tween(self, { y: startY - 200, alpha: 0 }, { duration: 1500, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); // Scale animation tween(self, { scaleX: 1.5, scaleY: 1.5 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.easeIn }); } }); }; return self; }); var MaterialParticle = Container.expand(function () { var self = Container.call(this); var particle = self.attachAsset('material', { anchorX: 0.5, anchorY: 0.5 }); self.init = function (startX, startY) { self.x = startX; self.y = startY; // Random direction for particle var angle = Math.random() * Math.PI * 2; var distance = 50 + Math.random() * 100; var targetX = startX + Math.cos(angle) * distance; var targetY = startY + Math.sin(angle) * distance; // Animate particle tween(self, { x: targetX, y: targetY, alpha: 0 }, { duration: 800, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); }; return self; }); var UpgradeMenu = Container.expand(function () { var self = Container.call(this); var panel = self.attachAsset('upgradePanel', { anchorX: 0.5, anchorY: 0.5 }); var clickUpgradeBtn = self.addChild(LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 })); clickUpgradeBtn.y = -200; var valueUpgradeBtn = self.addChild(LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 })); valueUpgradeBtn.y = -50; var evolutionUpgradeBtn = self.addChild(LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 })); evolutionUpgradeBtn.y = 100; var closeBtn = self.addChild(LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5, width: 100, height: 60 })); closeBtn.y = 300; var clickUpgradeText = new Text2('Upgrade Click\nCost: ' + storage.clickUpgradeCost, { size: 40, fill: 0xFFFFFF }); clickUpgradeText.anchor.set(0.5, 0.5); clickUpgradeBtn.addChild(clickUpgradeText); var valueUpgradeText = new Text2('Upgrade Value\nCost: ' + storage.valueUpgradeCost, { size: 40, fill: 0xFFFFFF }); valueUpgradeText.anchor.set(0.5, 0.5); valueUpgradeBtn.addChild(valueUpgradeText); var evolutionUpgradeText = new Text2('Evolve Rock\nCost: ' + storage.evolutionUpgradeCost, { size: 40, fill: 0xFFFFFF }); evolutionUpgradeText.anchor.set(0.5, 0.5); evolutionUpgradeBtn.addChild(evolutionUpgradeText); var closeText = new Text2('Close', { size: 36, fill: 0xFFFFFF }); closeText.anchor.set(0.5, 0.5); closeBtn.addChild(closeText); self.updateTexts = function () { clickUpgradeText.setText('Upgrade Click (+' + storage.materialPerClick + ')\nCost: ' + storage.clickUpgradeCost); valueUpgradeText.setText('Upgrade Value (+' + storage.coinValue + ')\nCost: ' + storage.valueUpgradeCost); evolutionUpgradeText.setText('Evolve Rock (Lvl ' + (storage.evolutionLevel + 1) + ')\nCost: ' + storage.evolutionUpgradeCost); }; clickUpgradeBtn.down = function () { if (coins >= storage.clickUpgradeCost) { coins -= storage.clickUpgradeCost; storage.coins = coins; storage.materialPerClick += 1; storage.clickUpgradeLevel += 1; storage.clickUpgradeCost = Math.floor(storage.clickUpgradeCost * 1.5); LK.getSound('upgrade').play(); self.updateTexts(); updateCoinDisplay(); } }; valueUpgradeBtn.down = function () { if (coins >= storage.valueUpgradeCost) { coins -= storage.valueUpgradeCost; storage.coins = coins; storage.coinValue += 1; storage.valueUpgradeLevel += 1; storage.valueUpgradeCost = Math.floor(storage.valueUpgradeCost * 2); LK.getSound('upgrade').play(); self.updateTexts(); updateCoinDisplay(); } }; evolutionUpgradeBtn.down = function () { if (coins >= storage.evolutionUpgradeCost) { coins -= storage.evolutionUpgradeCost; storage.coins = coins; storage.evolutionLevel += 1; storage.evolutionUpgradeCost = Math.floor(storage.evolutionUpgradeCost * 3); LK.getSound('upgrade').play(); self.updateTexts(); updateCoinDisplay(); updateRockAppearance(); } }; closeBtn.down = function () { upgradeMenuOpen = false; self.visible = false; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a1a2e }); /**** * Game Code ****/ var coins = storage.coins; var materials = 0; var upgradeMenuOpen = false; // Create central rock var rock = game.addChild(LK.getAsset('rock', { anchorX: 0.5, anchorY: 0.5 })); rock.x = 2048 / 2; rock.y = 2732 / 2; // Add visual improvements to rock based on upgrade levels function updateRockAppearance() { var totalUpgrades = storage.clickUpgradeLevel + storage.valueUpgradeLevel; var oldRock = rock; var newRockAsset; var newScale = 1; var newTint = 0xFFFFFF; // Evolution changes rock appearance dramatically if (storage.evolutionLevel >= 3) { newRockAsset = 'rock_magical'; newScale = 1.0; newTint = 0xFFFFFF; } else if (storage.evolutionLevel >= 2) { newRockAsset = 'rock_crystal'; newScale = 1.0; newTint = 0xFFFFFF; } else if (storage.evolutionLevel >= 1) { newRockAsset = 'rock_lava'; newScale = 1.0; newTint = 0xFFFFFF; } else { newRockAsset = 'rock'; if (totalUpgrades > 5) { newTint = 0xFFD700; // Golden color } else if (totalUpgrades > 2) { newTint = 0xC0C0C0; // Silver color } else { newTint = 0xFFFFFF; } } // Replace rock with new evolved version if needed var currentAssetId = rock._assetId || 'rock'; if (currentAssetId !== newRockAsset) { var newRock = game.addChild(LK.getAsset(newRockAsset, { anchorX: 0.5, anchorY: 0.5 })); newRock.x = rock.x; newRock.y = rock.y; newRock._assetId = newRockAsset; // Copy event handlers newRock.down = rock.down; // Remove old rock and replace reference game.removeChild(rock); rock = newRock; } // Apply visual effects rock.scaleX = newScale; rock.scaleY = newScale; rock.tint = newTint; } // Create UI elements var coinText = new Text2('Coins: 0', { size: 80, fill: 0xFFD700 }); coinText.anchor.set(0.5, 0); LK.gui.top.addChild(coinText); var materialText = new Text2('Materials: 0', { size: 60, fill: 0xFFFFFF }); materialText.anchor.set(0, 0); materialText.x = 20; materialText.y = 120; LK.gui.topLeft.addChild(materialText); var upgradeBtn = game.addChild(LK.getAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 })); upgradeBtn.x = 2048 / 2; upgradeBtn.y = 2732 - 150; var upgradeBtnText = new Text2('UPGRADES', { size: 50, fill: 0xFFFFFF }); upgradeBtnText.anchor.set(0.5, 0.5); upgradeBtn.addChild(upgradeBtnText); var sellBtn = game.addChild(LK.getAsset('sellButton', { anchorX: 0.5, anchorY: 0.5 })); sellBtn.x = 2048 / 2; sellBtn.y = 2732 - 250; var sellBtnText = new Text2('SELL MATERIALS', { size: 40, fill: 0xFFFFFF }); sellBtnText.anchor.set(0.5, 0.5); sellBtn.addChild(sellBtnText); // Create upgrade menu var upgradeMenu = game.addChild(new UpgradeMenu()); upgradeMenu.x = 2048 / 2; upgradeMenu.y = 2732 / 2; upgradeMenu.visible = false; // Arrays for particles var materialParticles = []; var coinParticles = []; // Update functions function updateCoinDisplay() { coinText.setText('Coins: ' + coins); } function updateMaterialDisplay() { materialText.setText('Materials: ' + materials); } // Initialize displays updateCoinDisplay(); updateMaterialDisplay(); updateRockAppearance(); // Rock click handler rock.down = function (x, y, obj) { if (upgradeMenuOpen) return; // Mine materials materials += storage.materialPerClick; updateMaterialDisplay(); // Create material particles for (var i = 0; i < storage.materialPerClick; i++) { var particle = new MaterialParticle(); materialParticles.push(particle); game.addChild(particle); particle.init(rock.x, rock.y); } // Rock animation tween(rock, { scaleX: 1.1, scaleY: 1.1 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(rock, { scaleX: 1, scaleY: 1 }, { duration: 100, easing: tween.easeIn }); } }); LK.getSound('mine').play(); }; // Upgrade button handler upgradeBtn.down = function () { upgradeMenuOpen = !upgradeMenuOpen; upgradeMenu.visible = upgradeMenuOpen; if (upgradeMenuOpen) { upgradeMenu.updateTexts(); } }; // Sell button handler sellBtn.down = function () { if (upgradeMenuOpen || materials <= 0) return; // Convert all materials to coins var coinsToAdd = materials * storage.coinValue; coins += coinsToAdd; storage.coins = coins; // Create coin particles for visual feedback for (var i = 0; i < Math.min(materials, 5); i++) { var coinParticle = new CoinParticle(); coinParticles.push(coinParticle); game.addChild(coinParticle); coinParticle.init(rock.x + i * 20 - 40, rock.y); } materials = 0; updateCoinDisplay(); updateMaterialDisplay(); LK.getSound('coin').play(); }; game.update = function () { // Clean up destroyed particles for (var i = materialParticles.length - 1; i >= 0; i--) { if (materialParticles[i].destroyed) { materialParticles.splice(i, 1); } } for (var j = coinParticles.length - 1; j >= 0; j--) { if (coinParticles[j].destroyed) { coinParticles.splice(j, 1); } } // Update rock appearance updateRockAppearance(); };
===================================================================
--- original.js
+++ change.js
@@ -208,26 +208,55 @@
rock.y = 2732 / 2;
// Add visual improvements to rock based on upgrade levels
function updateRockAppearance() {
var totalUpgrades = storage.clickUpgradeLevel + storage.valueUpgradeLevel;
+ var oldRock = rock;
+ var newRockAsset;
+ var newScale = 1;
+ var newTint = 0xFFFFFF;
// Evolution changes rock appearance dramatically
if (storage.evolutionLevel >= 3) {
- rock.tint = 0xFF00FF; // Magical purple for high evolution
- rock.scaleX = 1.5;
- rock.scaleY = 1.5;
+ newRockAsset = 'rock_magical';
+ newScale = 1.0;
+ newTint = 0xFFFFFF;
} else if (storage.evolutionLevel >= 2) {
- rock.tint = 0x00FFFF; // Crystal blue
- rock.scaleX = 1.3;
- rock.scaleY = 1.3;
+ newRockAsset = 'rock_crystal';
+ newScale = 1.0;
+ newTint = 0xFFFFFF;
} else if (storage.evolutionLevel >= 1) {
- rock.tint = 0xFF4500; // Lava orange
- rock.scaleX = 1.2;
- rock.scaleY = 1.2;
- } else if (totalUpgrades > 5) {
- rock.tint = 0xFFD700; // Golden color
- } else if (totalUpgrades > 2) {
- rock.tint = 0xC0C0C0; // Silver color
+ newRockAsset = 'rock_lava';
+ newScale = 1.0;
+ newTint = 0xFFFFFF;
+ } else {
+ newRockAsset = 'rock';
+ if (totalUpgrades > 5) {
+ newTint = 0xFFD700; // Golden color
+ } else if (totalUpgrades > 2) {
+ newTint = 0xC0C0C0; // Silver color
+ } else {
+ newTint = 0xFFFFFF;
+ }
}
+ // Replace rock with new evolved version if needed
+ var currentAssetId = rock._assetId || 'rock';
+ if (currentAssetId !== newRockAsset) {
+ var newRock = game.addChild(LK.getAsset(newRockAsset, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ }));
+ newRock.x = rock.x;
+ newRock.y = rock.y;
+ newRock._assetId = newRockAsset;
+ // Copy event handlers
+ newRock.down = rock.down;
+ // Remove old rock and replace reference
+ game.removeChild(rock);
+ rock = newRock;
+ }
+ // Apply visual effects
+ rock.scaleX = newScale;
+ rock.scaleY = newScale;
+ rock.tint = newTint;
}
// Create UI elements
var coinText = new Text2('Coins: 0', {
size: 80,
saco de tierra. In-Game asset. 2d. High contrast. No shadows. pixelart
roca magma. In-Game asset. 2d. High contrast. No shadows. pixelart
roca con trozos de cristal. In-Game asset. 2d. High contrast. No shadows. pixelart
amatista. In-Game asset. 2d. High contrast. No shadows. pixelart
roca gris oscuro con diamantes. In-Game asset. 2d. High contrast. No shadows. pixelart
roca madre. In-Game asset. 2d. High contrast. No shadows. pixelart
lapizlazuli. In-Game asset. 2d. High contrast. No shadows. pixelart
mineral de oro con lapizlazuli incrustado. In-Game asset. 2d. High contrast. No shadows. pixelart
mina abandonada. In-Game asset. 2d. High contrast. No shadows. pixelart