Code edit (2 edits merged)
Please save this source code
User prompt
haz otro boton de mejora el qual te de +50 por click
User prompt
el boton de mutear la musica ponlo abajo a la izquierda
User prompt
haz un boton de mutear musica y que funcione
User prompt
elimina el boton de auto click
Code edit (3 edits merged)
Please save this source code
User prompt
quando pulsas el boton de 5 clicks `por segundo en el texto Auto: $0/sec tiene que cambiar ha 5$
Code edit (4 edits merged)
Please save this source code
User prompt
desace lo ultimo que te dije
User prompt
el 3r boton da 10 click cambialo a 5
Code edit (1 edits merged)
Please save this source code
User prompt
el boton de 5 clicks por segundo hace 10 , cambialo a 5 y un 50% mas lento
User prompt
el boton de 5 ckicks per segundo hace 50 cambialo a 5
User prompt
el boton de 5 clicks por segundo no funciona
User prompt
añade otro boton de mejora de un autoclick que de 5 clicks por segundo
User prompt
el segundo boton quando lo pulsas multiplica por 8 y no tiene que hacerlo, haz que le sume 8
User prompt
cambia la configuracion de los botones, en vez de x en un +
User prompt
ahora añade un boton debajo del que hay de +8 click por click
User prompt
quita los quatro botones de mejora de abajo solo deja el de 2x
User prompt
pon el archivo "roblox_minecraft_fortnite_video_game_music_358426.mp3" como musica de fondo
User prompt
quita el boton de ajustes
User prompt
quita la musica background
User prompt
pon el archivo "roblox_minecraft_fortnite_video_game_music_358426.mp3" como musica de fondo
User prompt
quita lo ultimo que te dije
User prompt
arregla el slider que se queda pillado con el mouse y haz que se baje el volumen del coinClick, upgrade y Music ↪💡 Consider importing and using the following plugins: @upit/storage.v1
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var ConfirmDialog = Container.expand(function () {
var self = Container.call(this);
var dialogGraphics = self.attachAsset('resetButton', {
anchorX: 0.5,
anchorY: 0.5
});
var confirmText = self.addChild(new Text2('Estas seguro?', {
size: 50,
fill: 0xFFFFFF
}));
confirmText.anchor.set(0.5, 0.5);
confirmText.y = -30;
var confirmButton = self.attachAsset('resetButton', {
anchorX: 0.5,
anchorY: 0.5
});
confirmButton.y = 0;
var buttonText = confirmButton.addChild(new Text2('Confirmar', {
size: 40,
fill: 0xFFFFFF
}));
buttonText.anchor.set(0.5, 0.5);
confirmButton.down = function (x, y, obj) {
if (self.onConfirm) {
self.onConfirm();
}
darkOverlay.destroy(); // Remove the dark overlay when confirmed
self.destroy();
};
return self;
});
var MoneyButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('moneyButton', {
anchorX: 0.5,
anchorY: 0.5
});
var moneyText = self.addChild(new Text2('', {
size: 200,
fill: 0xFFFFFF
}));
moneyText.anchor.set(0.5, 0.5);
self.down = function (x, y, obj) {
tween(buttonGraphics, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 50
});
var coinSound = LK.getSound('coinClick');
coinSound.volume = (storage.gameVolume || 1.0) * 0.7;
coinSound.play();
var earned = moneyPerClick;
money += earned;
updateMoneyDisplay();
var particle = new MoneyParticle();
particle.setValue(earned);
particle.x = self.x + (Math.random() - 0.5) * 200;
particle.y = self.y - 100;
game.addChild(particle);
moneyParticles.push(particle);
};
self.up = function (x, y, obj) {
tween(buttonGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
};
return self;
});
var MoneyParticle = Container.expand(function () {
var self = Container.call(this);
// Removed the yellow square asset to display only the number of coins earned per click
var particleText = self.addChild(new Text2('+$0', {
size: 60,
fill: 0xFFFFFF
}));
particleText.anchor.set(0.5, 0.5);
self.lifetime = 60;
self.velocityY = -8;
self.setValue = function (value) {
particleText.setText('$' + formatNumber(value)); // Display the number of coins earned per click with a dollar symbol
};
self.update = function () {
self.y += self.velocityY;
self.velocityY += 0.3;
self.lifetime--;
self.alpha = self.lifetime / 60;
if (self.lifetime <= 0) {
self.shouldDestroy = true;
}
};
return self;
});
var ResetButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('resetButton', {
anchorX: 0.5,
anchorY: 0.5
});
var resetText = self.addChild(new Text2('Reiniciar', {
size: 40,
fill: 0xFFFFFF
}));
resetText.anchor.set(0.5, 0.5);
self.down = function (x, y, obj) {
// Darken the background
darkOverlay = LK.getAsset('resetButton', {
width: 2048,
height: 2732,
alpha: 0.5,
interactive: true,
tint: 0x000000
});
game.addChild(darkOverlay);
var confirmDialog = new ConfirmDialog();
confirmDialog.onConfirm = function () {
darkOverlay.destroy(); // Remove the dark overlay when confirmed
// Reset money and purchases
money = 0;
moneyPerClick = 1;
autoClickerRate = 0;
for (var i = 0; i < upgradeButtons.length; i++) {
upgradeButtons[i].purchased = false;
upgradeButtons[i].updateDisplay();
if (upgradeButtons[i].upgradeType === 'click2x') {
upgradeButtons[i].getChildAt(1).setText('2x Click Power');
} else if (upgradeButtons[i].upgradeType === 'click5x') {
upgradeButtons[i].getChildAt(1).setText('5x Click Power');
} else if (upgradeButtons[i].upgradeType === 'click10x') {
upgradeButtons[i].getChildAt(1).setText('10x Click Power');
} else if (upgradeButtons[i].upgradeType === 'auto1') {
upgradeButtons[i].getChildAt(1).setText('Auto Clicker');
} else if (upgradeButtons[i].upgradeType === 'auto2') {
upgradeButtons[i].getChildAt(1).setText('Super Auto');
}
upgradeButtons[i].getChildAt(2).setText('$' + formatNumber(upgradeButtons[i].cost)); // Reset the cost text
}
// Reset upgrades
for (var i = 0; i < upgradeData.length; i++) {
upgradeData[i].cost = upgradeData[i].cost; // Reset cost to initial value
upgradeData[i].multiplier = upgradeData[i].multiplier; // Reset multiplier to initial value
}
updateMoneyDisplay();
saveGame();
};
game.addChild(confirmDialog);
confirmDialog.x = 2048 / 2;
confirmDialog.y = 2732 / 2;
confirmDialog.onConfirm = function () {
// Reset money and purchases
money = 0;
moneyPerClick = 1;
autoClickerRate = 0;
for (var i = 0; i < upgradeButtons.length; i++) {
upgradeButtons[i].purchased = false;
upgradeButtons[i].updateDisplay();
if (upgradeButtons[i].upgradeType === 'click2x') {
upgradeButtons[i].getChildAt(1).setText('2x Click Power');
} else if (upgradeButtons[i].upgradeType === 'click5x') {
upgradeButtons[i].getChildAt(1).setText('5x Click Power');
} else if (upgradeButtons[i].upgradeType === 'click10x') {
upgradeButtons[i].getChildAt(1).setText('10x Click Power');
} else if (upgradeButtons[i].upgradeType === 'auto1') {
upgradeButtons[i].getChildAt(1).setText('Auto Clicker');
} else if (upgradeButtons[i].upgradeType === 'auto2') {
upgradeButtons[i].getChildAt(1).setText('Super Auto');
}
upgradeButtons[i].getChildAt(2).setText('$' + formatNumber(upgradeButtons[i].cost)); // Reset the cost text
}
// Reset upgrades
for (var i = 0; i < upgradeData.length; i++) {
upgradeData[i].cost = upgradeData[i].cost; // Reset cost to initial value
upgradeData[i].multiplier = upgradeData[i].multiplier; // Reset multiplier to initial value
}
updateMoneyDisplay();
saveGame();
};
game.addChild(confirmDialog);
};
return self;
});
var SettingsDialog = Container.expand(function () {
var self = Container.call(this);
// Panel background
var panelGraphics = self.attachAsset('settingsPanel', {
anchorX: 0.5,
anchorY: 0.5
});
// Title
var titleText = self.addChild(new Text2('AJUSTES', {
size: 60,
fill: 0xFFFFFF
}));
titleText.anchor.set(0.5, 0.5);
titleText.y = -200;
// Volume label
var volumeLabel = self.addChild(new Text2('Volumen:', {
size: 40,
fill: 0xFFFFFF
}));
volumeLabel.anchor.set(0.5, 0.5);
volumeLabel.y = -100;
// Volume slider background
var sliderBg = self.attachAsset('volumeSlider', {
anchorX: 0.5,
anchorY: 0.5
});
sliderBg.y = -30;
// Volume slider handle
var sliderHandle = self.attachAsset('volumeHandle', {
anchorX: 0.5,
anchorY: 0.5
});
sliderHandle.y = -30;
// Volume percentage text
var volumeText = self.addChild(new Text2('100%', {
size: 35,
fill: 0xFFFFFF
}));
volumeText.anchor.set(0.5, 0.5);
volumeText.y = 40;
// Close button
var closeButton = self.attachAsset('resetButton', {
anchorX: 0.5,
anchorY: 0.5,
width: 200,
height: 80
});
closeButton.y = 150;
var closeText = closeButton.addChild(new Text2('CERRAR', {
size: 35,
fill: 0xFFFFFF
}));
closeText.anchor.set(0.5, 0.5);
// Initialize volume
var currentVolume = storage.gameVolume || 1.0;
self.isDragging = false; // Make isDragging accessible from parent
// Update slider position based on volume
function updateSliderPosition() {
var sliderWidth = 400;
var handlePosition = (currentVolume - 0) / (1 - 0) * (sliderWidth - 40) - (sliderWidth - 40) / 2;
sliderHandle.x = handlePosition;
volumeText.setText(Math.round(currentVolume * 100) + '%');
}
// Initial position
updateSliderPosition();
// Slider interaction
sliderBg.down = function (x, y, obj) {
self.isDragging = true;
var localX = x - sliderBg.x;
var sliderWidth = 400;
var normalizedX = (localX + sliderWidth / 2) / sliderWidth;
currentVolume = Math.max(0, Math.min(1, normalizedX));
updateSliderPosition();
storage.gameVolume = currentVolume;
};
sliderHandle.down = function (x, y, obj) {
self.isDragging = true;
};
self.up = function (x, y, obj) {
self.isDragging = false;
};
self.move = function (x, y, obj) {
if (self.isDragging) {
var localX = x - sliderBg.x;
var sliderWidth = 400;
var normalizedX = (localX + sliderWidth / 2) / sliderWidth;
currentVolume = Math.max(0, Math.min(1, normalizedX));
updateSliderPosition();
storage.gameVolume = currentVolume;
}
};
closeButton.down = function (x, y, obj) {
if (self.onClose) {
self.onClose();
}
if (darkOverlay) {
darkOverlay.destroy();
}
self.destroy();
};
return self;
});
var UpgradeButton = Container.expand(function () {
var self = Container.call(this);
self.upgradeType = '';
self.cost = 0;
self.multiplier = 1;
self.purchased = false;
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.1
});
var titleText = self.addChild(new Text2('Upgrade', {
size: 40,
fill: 0xFFFFFF
}));
titleText.anchor.set(0.5, 0.5);
titleText.y = 35;
var costText = self.addChild(new Text2('$0', {
size: 40,
fill: 0xFFFFFF
}));
costText.anchor.set(0.5, 0.5);
costText.y = 90;
self.setup = function (type, baseCost, mult) {
self.upgradeType = type;
self.cost = baseCost;
self.multiplier = mult;
if (type === 'click2x') {
titleText.setText('2x Click Power');
} else if (type === 'click5x') {
titleText.setText('5x Click Power');
} else if (type === 'click10x') {
titleText.setText('10x Click Power');
} else if (type === 'auto1') {
titleText.setText('Auto Clicker');
} else if (type === 'auto2') {
titleText.setText('Super Auto');
}
self.updateDisplay();
};
self.updateDisplay = function () {
costText.setText('$' + formatNumber(self.cost));
if (money >= self.cost && !self.purchased) {
buttonGraphics.tint = 0xffffff;
} else {
buttonGraphics.tint = 0x666666;
}
};
self.down = function (x, y, obj) {
if (money >= self.cost && !self.purchased) {
money -= self.cost;
self.purchased = true;
if (self.upgradeType.startsWith('click')) {
moneyPerClick *= self.multiplier;
} else if (self.upgradeType.startsWith('auto')) {
if (self.upgradeType === 'auto1') {
autoClickerRate += 1;
} else if (self.upgradeType === 'auto2') {
autoClickerRate += 5;
}
}
var upgradeSound = LK.getSound('upgrade');
upgradeSound.volume = storage.gameVolume || 1.0;
upgradeSound.play();
buttonGraphics.tint = 0x4CAF50;
titleText.setText('PURCHASED');
costText.setText('');
updateMoneyDisplay();
saveGame();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
var darkOverlay; // Define darkOverlay in the global scope
var money = storage.money || 0;
var moneyPerClick = storage.moneyPerClick || 1;
var autoClickerRate = storage.autoClickerRate || 1;
var autoClickerTimer = 0;
var moneyParticles = [];
var moneyDisplay;
var moneyPerClickDisplay;
var autoIncomeDisplay;
var moneyButton;
var upgradeButtons = [];
function formatNumber(num) {
if (num >= 1000000000) {
return (num / 1000000000).toFixed(1) + 'B';
} else if (num >= 1000000) {
return (num / 1000000).toFixed(1) + 'M';
} else if (num >= 1000) {
return (num / 1000).toFixed(1) + 'K';
}
return Math.floor(num).toString();
}
function updateMoneyDisplay() {
moneyDisplay.setText(formatNumber(money));
moneyPerClickDisplay.setText('Per Click: $' + formatNumber(moneyPerClick));
autoIncomeDisplay.setText('Auto: $' + formatNumber(autoClickerRate) + '/sec');
for (var i = 0; i < upgradeButtons.length; i++) {
upgradeButtons[i].updateDisplay();
}
}
function saveGame() {
storage.money = money;
storage.moneyPerClick = moneyPerClick;
storage.autoClickerRate = autoClickerRate;
}
// Create money display
moneyDisplay = new Text2('$0', {
size: 80,
fill: 0x4CAF50
});
moneyDisplay.anchor.set(0.5, 0);
moneyDisplay.x = 650;
moneyDisplay.y = 150;
game.addChild(moneyDisplay);
// Create money per click display
moneyPerClickDisplay = new Text2('Per Click: $1', {
size: 40,
fill: 0xFFFFFF
});
moneyPerClickDisplay.anchor.set(0.5, 0);
moneyPerClickDisplay.x = 650;
moneyPerClickDisplay.y = 250;
game.addChild(moneyPerClickDisplay);
// Create auto income display
autoIncomeDisplay = new Text2('Auto: $0/sec', {
size: 40,
fill: 0xFFFFFF
});
autoIncomeDisplay.anchor.set(0.5, 0);
autoIncomeDisplay.x = 650;
autoIncomeDisplay.y = 310;
game.addChild(autoIncomeDisplay);
// Create money button
moneyButton = new MoneyButton();
moneyButton.x = 650;
moneyButton.y = 800;
game.addChild(moneyButton);
// Create upgrade menu title
var upgradeTitle = new Text2('UPGRADES', {
size: 60,
fill: 0xFFFFFF
});
upgradeTitle.anchor.set(0.5, 0);
upgradeTitle.x = 1524;
upgradeTitle.y = 150;
game.addChild(upgradeTitle);
// Create upgrade buttons
var upgradeData = [{
type: 'click2x',
cost: 50,
multiplier: 2
}, {
type: 'auto1',
cost: 100,
multiplier: 1
}, {
type: 'click5x',
cost: 500,
multiplier: 5
}, {
type: 'auto2',
cost: 1000,
multiplier: 5
}, {
type: 'click10x',
cost: 5000,
multiplier: 10
}];
for (var i = 0; i < upgradeData.length; i++) {
var upgradeButton = new UpgradeButton();
upgradeButton.setup(upgradeData[i].type, upgradeData[i].cost, upgradeData[i].multiplier);
upgradeButton.x = 1524; // Align with the 'UPGRADES' text
upgradeButton.y = 250 + i * 200; // Position below the 'UPGRADES' text
game.addChild(upgradeButton);
upgradeButtons.push(upgradeButton);
}
// Update displays
updateMoneyDisplay();
// Start background music with volume control
var musicVolume = (storage.gameVolume || 1.0) * 0.3;
LK.playMusic('backgroundMusic', {
fade: {
start: 0,
end: musicVolume,
duration: 1000
}
});
// Create reset button
var resetButton = new ResetButton();
resetButton.x = 1800;
resetButton.y = 2600;
game.addChild(resetButton);
// Create settings button
var settingsButton = game.attachAsset('settingsButton', {
anchorX: 0.5,
anchorY: 0.5
});
settingsButton.x = 150;
settingsButton.y = 2600;
var settingsIcon = settingsButton.addChild(new Text2('⚙', {
size: 60,
fill: 0xFFFFFF
}));
settingsIcon.anchor.set(0.5, 0.5);
settingsButton.down = function (x, y, obj) {
// Create dark overlay
darkOverlay = LK.getAsset('resetButton', {
width: 2048,
height: 2732,
alpha: 0.5,
interactive: true,
tint: 0x000000
});
game.addChild(darkOverlay);
// Create settings dialog
var settingsDialog = new SettingsDialog();
settingsDialog.x = 2048 / 2;
settingsDialog.y = 2732 / 2;
settingsDialog.onClose = function () {
if (darkOverlay) {
darkOverlay.destroy();
darkOverlay = null;
}
};
game.addChild(settingsDialog);
};
// Global mouse up handler to stop slider dragging
game.up = function (x, y, obj) {
// Find any open settings dialog and stop dragging
for (var i = 0; i < game.children.length; i++) {
var child = game.children[i];
if (child instanceof SettingsDialog) {
child.isDragging = false;
break;
}
}
};
// Game update loop
game.update = function () {
// Auto clicker logic
if (autoClickerRate > 0) {
autoClickerTimer++;
if (autoClickerTimer >= 60) {
autoClickerTimer = 0;
money += 1; // Revert to original logic to give 1 dollar per second
updateMoneyDisplay();
saveGame();
}
}
// Update particles
for (var i = moneyParticles.length - 1; i >= 0; i--) {
var particle = moneyParticles[i];
if (particle.shouldDestroy) {
particle.destroy();
moneyParticles.splice(i, 1);
}
}
// Auto save every 5 seconds
if (LK.ticks % 300 === 0) {
saveGame();
}
}; /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var ConfirmDialog = Container.expand(function () {
var self = Container.call(this);
var dialogGraphics = self.attachAsset('resetButton', {
anchorX: 0.5,
anchorY: 0.5
});
var confirmText = self.addChild(new Text2('Estas seguro?', {
size: 50,
fill: 0xFFFFFF
}));
confirmText.anchor.set(0.5, 0.5);
confirmText.y = -30;
var confirmButton = self.attachAsset('resetButton', {
anchorX: 0.5,
anchorY: 0.5
});
confirmButton.y = 0;
var buttonText = confirmButton.addChild(new Text2('Confirmar', {
size: 40,
fill: 0xFFFFFF
}));
buttonText.anchor.set(0.5, 0.5);
confirmButton.down = function (x, y, obj) {
if (self.onConfirm) {
self.onConfirm();
}
darkOverlay.destroy(); // Remove the dark overlay when confirmed
self.destroy();
};
return self;
});
var MoneyButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('moneyButton', {
anchorX: 0.5,
anchorY: 0.5
});
var moneyText = self.addChild(new Text2('', {
size: 200,
fill: 0xFFFFFF
}));
moneyText.anchor.set(0.5, 0.5);
self.down = function (x, y, obj) {
tween(buttonGraphics, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 50
});
var coinSound = LK.getSound('coinClick');
coinSound.volume = (storage.gameVolume || 1.0) * 0.7;
coinSound.play();
var earned = moneyPerClick;
money += earned;
updateMoneyDisplay();
var particle = new MoneyParticle();
particle.setValue(earned);
particle.x = self.x + (Math.random() - 0.5) * 200;
particle.y = self.y - 100;
game.addChild(particle);
moneyParticles.push(particle);
};
self.up = function (x, y, obj) {
tween(buttonGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
};
return self;
});
var MoneyParticle = Container.expand(function () {
var self = Container.call(this);
// Removed the yellow square asset to display only the number of coins earned per click
var particleText = self.addChild(new Text2('+$0', {
size: 60,
fill: 0xFFFFFF
}));
particleText.anchor.set(0.5, 0.5);
self.lifetime = 60;
self.velocityY = -8;
self.setValue = function (value) {
particleText.setText('$' + formatNumber(value)); // Display the number of coins earned per click with a dollar symbol
};
self.update = function () {
self.y += self.velocityY;
self.velocityY += 0.3;
self.lifetime--;
self.alpha = self.lifetime / 60;
if (self.lifetime <= 0) {
self.shouldDestroy = true;
}
};
return self;
});
var ResetButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('resetButton', {
anchorX: 0.5,
anchorY: 0.5
});
var resetText = self.addChild(new Text2('Reiniciar', {
size: 40,
fill: 0xFFFFFF
}));
resetText.anchor.set(0.5, 0.5);
self.down = function (x, y, obj) {
// Darken the background
darkOverlay = LK.getAsset('resetButton', {
width: 2048,
height: 2732,
alpha: 0.5,
interactive: true,
tint: 0x000000
});
game.addChild(darkOverlay);
var confirmDialog = new ConfirmDialog();
confirmDialog.onConfirm = function () {
darkOverlay.destroy(); // Remove the dark overlay when confirmed
// Reset money and purchases
money = 0;
moneyPerClick = 1;
autoClickerRate = 0;
for (var i = 0; i < upgradeButtons.length; i++) {
upgradeButtons[i].purchased = false;
upgradeButtons[i].updateDisplay();
if (upgradeButtons[i].upgradeType === 'click2x') {
upgradeButtons[i].getChildAt(1).setText('2x Click Power');
} else if (upgradeButtons[i].upgradeType === 'click5x') {
upgradeButtons[i].getChildAt(1).setText('5x Click Power');
} else if (upgradeButtons[i].upgradeType === 'click10x') {
upgradeButtons[i].getChildAt(1).setText('10x Click Power');
} else if (upgradeButtons[i].upgradeType === 'auto1') {
upgradeButtons[i].getChildAt(1).setText('Auto Clicker');
} else if (upgradeButtons[i].upgradeType === 'auto2') {
upgradeButtons[i].getChildAt(1).setText('Super Auto');
}
upgradeButtons[i].getChildAt(2).setText('$' + formatNumber(upgradeButtons[i].cost)); // Reset the cost text
}
// Reset upgrades
for (var i = 0; i < upgradeData.length; i++) {
upgradeData[i].cost = upgradeData[i].cost; // Reset cost to initial value
upgradeData[i].multiplier = upgradeData[i].multiplier; // Reset multiplier to initial value
}
updateMoneyDisplay();
saveGame();
};
game.addChild(confirmDialog);
confirmDialog.x = 2048 / 2;
confirmDialog.y = 2732 / 2;
confirmDialog.onConfirm = function () {
// Reset money and purchases
money = 0;
moneyPerClick = 1;
autoClickerRate = 0;
for (var i = 0; i < upgradeButtons.length; i++) {
upgradeButtons[i].purchased = false;
upgradeButtons[i].updateDisplay();
if (upgradeButtons[i].upgradeType === 'click2x') {
upgradeButtons[i].getChildAt(1).setText('2x Click Power');
} else if (upgradeButtons[i].upgradeType === 'click5x') {
upgradeButtons[i].getChildAt(1).setText('5x Click Power');
} else if (upgradeButtons[i].upgradeType === 'click10x') {
upgradeButtons[i].getChildAt(1).setText('10x Click Power');
} else if (upgradeButtons[i].upgradeType === 'auto1') {
upgradeButtons[i].getChildAt(1).setText('Auto Clicker');
} else if (upgradeButtons[i].upgradeType === 'auto2') {
upgradeButtons[i].getChildAt(1).setText('Super Auto');
}
upgradeButtons[i].getChildAt(2).setText('$' + formatNumber(upgradeButtons[i].cost)); // Reset the cost text
}
// Reset upgrades
for (var i = 0; i < upgradeData.length; i++) {
upgradeData[i].cost = upgradeData[i].cost; // Reset cost to initial value
upgradeData[i].multiplier = upgradeData[i].multiplier; // Reset multiplier to initial value
}
updateMoneyDisplay();
saveGame();
};
game.addChild(confirmDialog);
};
return self;
});
var SettingsDialog = Container.expand(function () {
var self = Container.call(this);
// Panel background
var panelGraphics = self.attachAsset('settingsPanel', {
anchorX: 0.5,
anchorY: 0.5
});
// Title
var titleText = self.addChild(new Text2('AJUSTES', {
size: 60,
fill: 0xFFFFFF
}));
titleText.anchor.set(0.5, 0.5);
titleText.y = -200;
// Volume label
var volumeLabel = self.addChild(new Text2('Volumen:', {
size: 40,
fill: 0xFFFFFF
}));
volumeLabel.anchor.set(0.5, 0.5);
volumeLabel.y = -100;
// Volume slider background
var sliderBg = self.attachAsset('volumeSlider', {
anchorX: 0.5,
anchorY: 0.5
});
sliderBg.y = -30;
// Volume slider handle
var sliderHandle = self.attachAsset('volumeHandle', {
anchorX: 0.5,
anchorY: 0.5
});
sliderHandle.y = -30;
// Volume percentage text
var volumeText = self.addChild(new Text2('100%', {
size: 35,
fill: 0xFFFFFF
}));
volumeText.anchor.set(0.5, 0.5);
volumeText.y = 40;
// Close button
var closeButton = self.attachAsset('resetButton', {
anchorX: 0.5,
anchorY: 0.5,
width: 200,
height: 80
});
closeButton.y = 150;
var closeText = closeButton.addChild(new Text2('CERRAR', {
size: 35,
fill: 0xFFFFFF
}));
closeText.anchor.set(0.5, 0.5);
// Initialize volume
var currentVolume = storage.gameVolume || 1.0;
self.isDragging = false; // Make isDragging accessible from parent
// Update slider position based on volume
function updateSliderPosition() {
var sliderWidth = 400;
var handlePosition = (currentVolume - 0) / (1 - 0) * (sliderWidth - 40) - (sliderWidth - 40) / 2;
sliderHandle.x = handlePosition;
volumeText.setText(Math.round(currentVolume * 100) + '%');
}
// Initial position
updateSliderPosition();
// Slider interaction
sliderBg.down = function (x, y, obj) {
self.isDragging = true;
var localX = x - sliderBg.x;
var sliderWidth = 400;
var normalizedX = (localX + sliderWidth / 2) / sliderWidth;
currentVolume = Math.max(0, Math.min(1, normalizedX));
updateSliderPosition();
storage.gameVolume = currentVolume;
};
sliderHandle.down = function (x, y, obj) {
self.isDragging = true;
};
self.up = function (x, y, obj) {
self.isDragging = false;
};
self.move = function (x, y, obj) {
if (self.isDragging) {
var localX = x - sliderBg.x;
var sliderWidth = 400;
var normalizedX = (localX + sliderWidth / 2) / sliderWidth;
currentVolume = Math.max(0, Math.min(1, normalizedX));
updateSliderPosition();
storage.gameVolume = currentVolume;
}
};
closeButton.down = function (x, y, obj) {
if (self.onClose) {
self.onClose();
}
if (darkOverlay) {
darkOverlay.destroy();
}
self.destroy();
};
return self;
});
var UpgradeButton = Container.expand(function () {
var self = Container.call(this);
self.upgradeType = '';
self.cost = 0;
self.multiplier = 1;
self.purchased = false;
var buttonGraphics = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.1
});
var titleText = self.addChild(new Text2('Upgrade', {
size: 40,
fill: 0xFFFFFF
}));
titleText.anchor.set(0.5, 0.5);
titleText.y = 35;
var costText = self.addChild(new Text2('$0', {
size: 40,
fill: 0xFFFFFF
}));
costText.anchor.set(0.5, 0.5);
costText.y = 90;
self.setup = function (type, baseCost, mult) {
self.upgradeType = type;
self.cost = baseCost;
self.multiplier = mult;
if (type === 'click2x') {
titleText.setText('2x Click Power');
} else if (type === 'click5x') {
titleText.setText('5x Click Power');
} else if (type === 'click10x') {
titleText.setText('10x Click Power');
} else if (type === 'auto1') {
titleText.setText('Auto Clicker');
} else if (type === 'auto2') {
titleText.setText('Super Auto');
}
self.updateDisplay();
};
self.updateDisplay = function () {
costText.setText('$' + formatNumber(self.cost));
if (money >= self.cost && !self.purchased) {
buttonGraphics.tint = 0xffffff;
} else {
buttonGraphics.tint = 0x666666;
}
};
self.down = function (x, y, obj) {
if (money >= self.cost && !self.purchased) {
money -= self.cost;
self.purchased = true;
if (self.upgradeType.startsWith('click')) {
moneyPerClick *= self.multiplier;
} else if (self.upgradeType.startsWith('auto')) {
if (self.upgradeType === 'auto1') {
autoClickerRate += 1;
} else if (self.upgradeType === 'auto2') {
autoClickerRate += 5;
}
}
var upgradeSound = LK.getSound('upgrade');
upgradeSound.volume = storage.gameVolume || 1.0;
upgradeSound.play();
buttonGraphics.tint = 0x4CAF50;
titleText.setText('PURCHASED');
costText.setText('');
updateMoneyDisplay();
saveGame();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
var darkOverlay; // Define darkOverlay in the global scope
var money = storage.money || 0;
var moneyPerClick = storage.moneyPerClick || 1;
var autoClickerRate = storage.autoClickerRate || 1;
var autoClickerTimer = 0;
var moneyParticles = [];
var moneyDisplay;
var moneyPerClickDisplay;
var autoIncomeDisplay;
var moneyButton;
var upgradeButtons = [];
function formatNumber(num) {
if (num >= 1000000000) {
return (num / 1000000000).toFixed(1) + 'B';
} else if (num >= 1000000) {
return (num / 1000000).toFixed(1) + 'M';
} else if (num >= 1000) {
return (num / 1000).toFixed(1) + 'K';
}
return Math.floor(num).toString();
}
function updateMoneyDisplay() {
moneyDisplay.setText(formatNumber(money));
moneyPerClickDisplay.setText('Per Click: $' + formatNumber(moneyPerClick));
autoIncomeDisplay.setText('Auto: $' + formatNumber(autoClickerRate) + '/sec');
for (var i = 0; i < upgradeButtons.length; i++) {
upgradeButtons[i].updateDisplay();
}
}
function saveGame() {
storage.money = money;
storage.moneyPerClick = moneyPerClick;
storage.autoClickerRate = autoClickerRate;
}
// Create money display
moneyDisplay = new Text2('$0', {
size: 80,
fill: 0x4CAF50
});
moneyDisplay.anchor.set(0.5, 0);
moneyDisplay.x = 650;
moneyDisplay.y = 150;
game.addChild(moneyDisplay);
// Create money per click display
moneyPerClickDisplay = new Text2('Per Click: $1', {
size: 40,
fill: 0xFFFFFF
});
moneyPerClickDisplay.anchor.set(0.5, 0);
moneyPerClickDisplay.x = 650;
moneyPerClickDisplay.y = 250;
game.addChild(moneyPerClickDisplay);
// Create auto income display
autoIncomeDisplay = new Text2('Auto: $0/sec', {
size: 40,
fill: 0xFFFFFF
});
autoIncomeDisplay.anchor.set(0.5, 0);
autoIncomeDisplay.x = 650;
autoIncomeDisplay.y = 310;
game.addChild(autoIncomeDisplay);
// Create money button
moneyButton = new MoneyButton();
moneyButton.x = 650;
moneyButton.y = 800;
game.addChild(moneyButton);
// Create upgrade menu title
var upgradeTitle = new Text2('UPGRADES', {
size: 60,
fill: 0xFFFFFF
});
upgradeTitle.anchor.set(0.5, 0);
upgradeTitle.x = 1524;
upgradeTitle.y = 150;
game.addChild(upgradeTitle);
// Create upgrade buttons
var upgradeData = [{
type: 'click2x',
cost: 50,
multiplier: 2
}, {
type: 'auto1',
cost: 100,
multiplier: 1
}, {
type: 'click5x',
cost: 500,
multiplier: 5
}, {
type: 'auto2',
cost: 1000,
multiplier: 5
}, {
type: 'click10x',
cost: 5000,
multiplier: 10
}];
for (var i = 0; i < upgradeData.length; i++) {
var upgradeButton = new UpgradeButton();
upgradeButton.setup(upgradeData[i].type, upgradeData[i].cost, upgradeData[i].multiplier);
upgradeButton.x = 1524; // Align with the 'UPGRADES' text
upgradeButton.y = 250 + i * 200; // Position below the 'UPGRADES' text
game.addChild(upgradeButton);
upgradeButtons.push(upgradeButton);
}
// Update displays
updateMoneyDisplay();
// Start background music with volume control
var musicVolume = (storage.gameVolume || 1.0) * 0.3;
LK.playMusic('backgroundMusic', {
fade: {
start: 0,
end: musicVolume,
duration: 1000
}
});
// Create reset button
var resetButton = new ResetButton();
resetButton.x = 1800;
resetButton.y = 2600;
game.addChild(resetButton);
// Create settings button
var settingsButton = game.attachAsset('settingsButton', {
anchorX: 0.5,
anchorY: 0.5
});
settingsButton.x = 150;
settingsButton.y = 2600;
var settingsIcon = settingsButton.addChild(new Text2('⚙', {
size: 60,
fill: 0xFFFFFF
}));
settingsIcon.anchor.set(0.5, 0.5);
settingsButton.down = function (x, y, obj) {
// Create dark overlay
darkOverlay = LK.getAsset('resetButton', {
width: 2048,
height: 2732,
alpha: 0.5,
interactive: true,
tint: 0x000000
});
game.addChild(darkOverlay);
// Create settings dialog
var settingsDialog = new SettingsDialog();
settingsDialog.x = 2048 / 2;
settingsDialog.y = 2732 / 2;
settingsDialog.onClose = function () {
if (darkOverlay) {
darkOverlay.destroy();
darkOverlay = null;
}
};
game.addChild(settingsDialog);
};
// Global mouse up handler to stop slider dragging
game.up = function (x, y, obj) {
// Find any open settings dialog and stop dragging
for (var i = 0; i < game.children.length; i++) {
var child = game.children[i];
if (child instanceof SettingsDialog) {
child.isDragging = false;
break;
}
}
};
// Game update loop
game.update = function () {
// Auto clicker logic
if (autoClickerRate > 0) {
autoClickerTimer++;
if (autoClickerTimer >= 60) {
autoClickerTimer = 0;
money += 1; // Revert to original logic to give 1 dollar per second
updateMoneyDisplay();
saveGame();
}
}
// Update particles
for (var i = moneyParticles.length - 1; i >= 0; i--) {
var particle = moneyParticles[i];
if (particle.shouldDestroy) {
particle.destroy();
moneyParticles.splice(i, 1);
}
}
// Auto save every 5 seconds
if (LK.ticks % 300 === 0) {
saveGame();
}
};
Haz una moneda 2d pero un pixel. In-Game asset. 2d. High contrast. No shadows
haz un boton tipo pixel. In-Game asset. 2d. High contrast. No shadows
creame un paisage pixer de 2048x2732. In-Game asset. 2d. High contrast. No shadows
crea una caja de madera que este el medio vacio solo hacme el marco y un color de madera oscura en el centro. In-Game asset. 2d. High contrast. No shadows
haz una caja con bordes estrechos y el fondo de color madera oscuro. In-Game asset. 2d. High contrast. No shadows