User prompt
Haz más grande a la banana, que se pueda ver bien! Y resaltala ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Añade un fondo qué pueda poner una imagen
User prompt
Add a nice animation when you click on the banana and you can buy different skins of the banana and make the interface next to the banana bigger. ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Banana Evolution Clicker
Initial prompt
Quiero hacer un juego clicker donde solo tengas qué clickear un platano y te dará dinero para que lo puedas ir evolucionando
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Banana = Container.expand(function () {
var self = Container.call(this);
var bananaGraphics = self.attachAsset('banana', {
anchorX: 0.5,
anchorY: 0.5
});
self.evolutionStage = 0;
self.evolutionColors = [0xFFD700, 0xFF8C00, 0xFF4500, 0x8B4513, 0x800080, 0x00FFFF];
self.evolve = function () {
if (self.evolutionStage < self.evolutionColors.length - 1) {
self.evolutionStage++;
bananaGraphics.tint = self.evolutionColors[self.evolutionStage];
// Scale animation for evolution
tween(bananaGraphics, {
scaleX: 1.3,
scaleY: 1.3
}, {
duration: 200,
onFinish: function onFinish() {
tween(bananaGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 200
});
}
});
LK.getSound('evolution').play();
LK.effects.flashScreen(0xFFD700, 500);
}
};
self.down = function (x, y, obj) {
// Click animation
tween(bananaGraphics, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
onFinish: function onFinish() {
tween(bananaGraphics, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
}
});
// Earn coins based on click value
coins += clickValue;
updateCoinDisplay();
// Visual feedback
createFloatingText('+' + clickValue, self.x, self.y - 100);
LK.getSound('click').play();
// Check for evolution milestones
if (totalClicks % 100 === 0) {
self.evolve();
}
totalClicks++;
};
return self;
});
var FloatingText = Container.expand(function (text, startX, startY) {
var self = Container.call(this);
var textDisplay = new Text2(text, {
size: 50,
fill: 0xFFD700
});
textDisplay.anchor.set(0.5, 0.5);
self.addChild(textDisplay);
self.x = startX;
self.y = startY;
// Animate floating text
tween(self, {
y: self.y - 100,
alpha: 0
}, {
duration: 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
return self;
});
var UpgradeButton = Container.expand(function (upgradeData) {
var self = Container.call(this);
self.upgradeData = upgradeData;
var buttonBg = self.attachAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5
});
var titleText = new Text2(upgradeData.name, {
size: 40,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0.5);
titleText.y = -15;
self.addChild(titleText);
var costText = new Text2('Cost: ' + upgradeData.cost, {
size: 30,
fill: 0xFFFFFF
});
costText.anchor.set(0.5, 0.5);
costText.y = 15;
self.addChild(costText);
self.updateDisplay = function () {
costText.setText('Cost: ' + self.upgradeData.cost);
if (coins >= self.upgradeData.cost) {
buttonBg.tint = 0x4CAF50;
} else {
buttonBg.tint = 0x808080;
}
};
self.down = function (x, y, obj) {
if (coins >= self.upgradeData.cost) {
coins -= self.upgradeData.cost;
self.upgradeData.apply();
self.upgradeData.cost = Math.floor(self.upgradeData.cost * 1.5);
self.updateDisplay();
updateCoinDisplay();
LK.getSound('upgrade').play();
// Purchase animation
tween(buttonBg, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 150,
onFinish: function onFinish() {
tween(buttonBg, {
scaleX: 1,
scaleY: 1
}, {
duration: 150
});
}
});
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game variables
var coins = storage.coins || 0;
var clickValue = storage.clickValue || 1;
var autoClickerCount = storage.autoClickerCount || 0;
var autoClickerPower = storage.autoClickerPower || 1;
var totalClicks = storage.totalClicks || 0;
// UI elements
var coinDisplay;
var banana;
var upgradeButtons = [];
var floatingTexts = [];
// Initialize coin display
coinDisplay = new Text2('Coins: ' + coins, {
size: 60,
fill: 0xFFFFFF
});
coinDisplay.anchor.set(0.5, 0);
LK.gui.top.addChild(coinDisplay);
coinDisplay.y = 150;
// Create banana
banana = game.addChild(new Banana());
banana.x = 2048 / 2;
banana.y = 2732 / 2 - 200;
// Upgrade definitions
var upgrades = [{
name: "Better Click",
cost: storage.betterClickCost || 10,
apply: function apply() {
clickValue += 1;
storage.clickValue = clickValue;
}
}, {
name: "Auto Clicker",
cost: storage.autoClickerCost || 50,
apply: function apply() {
autoClickerCount += 1;
storage.autoClickerCount = autoClickerCount;
}
}, {
name: "Click Multiplier",
cost: storage.multiplierCost || 200,
apply: function apply() {
clickValue *= 2;
storage.clickValue = clickValue;
}
}, {
name: "Auto Power Up",
cost: storage.autoPowerCost || 500,
apply: function apply() {
autoClickerPower += 2;
storage.autoClickerPower = autoClickerPower;
}
}];
// Create upgrade buttons
for (var i = 0; i < upgrades.length; i++) {
var button = game.addChild(new UpgradeButton(upgrades[i]));
button.x = 2048 / 2;
button.y = 1800 + i * 120;
upgradeButtons.push(button);
}
// Helper functions
function updateCoinDisplay() {
coinDisplay.setText('Coins: ' + Math.floor(coins));
// Update upgrade button states
for (var i = 0; i < upgradeButtons.length; i++) {
upgradeButtons[i].updateDisplay();
}
// Save progress
storage.coins = coins;
storage.totalClicks = totalClicks;
storage.betterClickCost = upgrades[0].cost;
storage.autoClickerCost = upgrades[1].cost;
storage.multiplierCost = upgrades[2].cost;
storage.autoPowerCost = upgrades[3].cost;
}
function createFloatingText(text, x, y) {
var floatingText = game.addChild(new FloatingText(text, x, y));
floatingTexts.push(floatingText);
}
// Auto clicker timer
var autoClickerTimer = 0;
// Initial display update
updateCoinDisplay();
for (var i = 0; i < upgradeButtons.length; i++) {
upgradeButtons[i].updateDisplay();
}
game.update = function () {
// Auto clicker functionality
if (autoClickerCount > 0) {
autoClickerTimer++;
if (autoClickerTimer >= 60) {
// Auto click every second (60 ticks)
autoClickerTimer = 0;
var autoEarnings = autoClickerCount * autoClickerPower;
coins += autoEarnings;
updateCoinDisplay();
// Show auto earning feedback occasionally
if (LK.ticks % 180 === 0) {
// Every 3 seconds
createFloatingText('+' + autoEarnings + ' (auto)', banana.x + 150, banana.y);
}
}
}
// Clean up destroyed floating texts
for (var i = floatingTexts.length - 1; i >= 0; i--) {
if (!floatingTexts[i].parent) {
floatingTexts.splice(i, 1);
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,270 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
+
+/****
+* Classes
+****/
+var Banana = Container.expand(function () {
+ var self = Container.call(this);
+ var bananaGraphics = self.attachAsset('banana', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.evolutionStage = 0;
+ self.evolutionColors = [0xFFD700, 0xFF8C00, 0xFF4500, 0x8B4513, 0x800080, 0x00FFFF];
+ self.evolve = function () {
+ if (self.evolutionStage < self.evolutionColors.length - 1) {
+ self.evolutionStage++;
+ bananaGraphics.tint = self.evolutionColors[self.evolutionStage];
+ // Scale animation for evolution
+ tween(bananaGraphics, {
+ scaleX: 1.3,
+ scaleY: 1.3
+ }, {
+ duration: 200,
+ onFinish: function onFinish() {
+ tween(bananaGraphics, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 200
+ });
+ }
+ });
+ LK.getSound('evolution').play();
+ LK.effects.flashScreen(0xFFD700, 500);
+ }
+ };
+ self.down = function (x, y, obj) {
+ // Click animation
+ tween(bananaGraphics, {
+ scaleX: 0.9,
+ scaleY: 0.9
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(bananaGraphics, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100
+ });
+ }
+ });
+ // Earn coins based on click value
+ coins += clickValue;
+ updateCoinDisplay();
+ // Visual feedback
+ createFloatingText('+' + clickValue, self.x, self.y - 100);
+ LK.getSound('click').play();
+ // Check for evolution milestones
+ if (totalClicks % 100 === 0) {
+ self.evolve();
+ }
+ totalClicks++;
+ };
+ return self;
+});
+var FloatingText = Container.expand(function (text, startX, startY) {
+ var self = Container.call(this);
+ var textDisplay = new Text2(text, {
+ size: 50,
+ fill: 0xFFD700
+ });
+ textDisplay.anchor.set(0.5, 0.5);
+ self.addChild(textDisplay);
+ self.x = startX;
+ self.y = startY;
+ // Animate floating text
+ tween(self, {
+ y: self.y - 100,
+ alpha: 0
+ }, {
+ duration: 1000,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ self.destroy();
+ }
+ });
+ return self;
+});
+var UpgradeButton = Container.expand(function (upgradeData) {
+ var self = Container.call(this);
+ self.upgradeData = upgradeData;
+ var buttonBg = self.attachAsset('upgradeButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var titleText = new Text2(upgradeData.name, {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ titleText.anchor.set(0.5, 0.5);
+ titleText.y = -15;
+ self.addChild(titleText);
+ var costText = new Text2('Cost: ' + upgradeData.cost, {
+ size: 30,
+ fill: 0xFFFFFF
+ });
+ costText.anchor.set(0.5, 0.5);
+ costText.y = 15;
+ self.addChild(costText);
+ self.updateDisplay = function () {
+ costText.setText('Cost: ' + self.upgradeData.cost);
+ if (coins >= self.upgradeData.cost) {
+ buttonBg.tint = 0x4CAF50;
+ } else {
+ buttonBg.tint = 0x808080;
+ }
+ };
+ self.down = function (x, y, obj) {
+ if (coins >= self.upgradeData.cost) {
+ coins -= self.upgradeData.cost;
+ self.upgradeData.apply();
+ self.upgradeData.cost = Math.floor(self.upgradeData.cost * 1.5);
+ self.updateDisplay();
+ updateCoinDisplay();
+ LK.getSound('upgrade').play();
+ // Purchase animation
+ tween(buttonBg, {
+ scaleX: 1.1,
+ scaleY: 1.1
+ }, {
+ duration: 150,
+ onFinish: function onFinish() {
+ tween(buttonBg, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 150
+ });
+ }
+ });
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var coins = storage.coins || 0;
+var clickValue = storage.clickValue || 1;
+var autoClickerCount = storage.autoClickerCount || 0;
+var autoClickerPower = storage.autoClickerPower || 1;
+var totalClicks = storage.totalClicks || 0;
+// UI elements
+var coinDisplay;
+var banana;
+var upgradeButtons = [];
+var floatingTexts = [];
+// Initialize coin display
+coinDisplay = new Text2('Coins: ' + coins, {
+ size: 60,
+ fill: 0xFFFFFF
+});
+coinDisplay.anchor.set(0.5, 0);
+LK.gui.top.addChild(coinDisplay);
+coinDisplay.y = 150;
+// Create banana
+banana = game.addChild(new Banana());
+banana.x = 2048 / 2;
+banana.y = 2732 / 2 - 200;
+// Upgrade definitions
+var upgrades = [{
+ name: "Better Click",
+ cost: storage.betterClickCost || 10,
+ apply: function apply() {
+ clickValue += 1;
+ storage.clickValue = clickValue;
+ }
+}, {
+ name: "Auto Clicker",
+ cost: storage.autoClickerCost || 50,
+ apply: function apply() {
+ autoClickerCount += 1;
+ storage.autoClickerCount = autoClickerCount;
+ }
+}, {
+ name: "Click Multiplier",
+ cost: storage.multiplierCost || 200,
+ apply: function apply() {
+ clickValue *= 2;
+ storage.clickValue = clickValue;
+ }
+}, {
+ name: "Auto Power Up",
+ cost: storage.autoPowerCost || 500,
+ apply: function apply() {
+ autoClickerPower += 2;
+ storage.autoClickerPower = autoClickerPower;
+ }
+}];
+// Create upgrade buttons
+for (var i = 0; i < upgrades.length; i++) {
+ var button = game.addChild(new UpgradeButton(upgrades[i]));
+ button.x = 2048 / 2;
+ button.y = 1800 + i * 120;
+ upgradeButtons.push(button);
+}
+// Helper functions
+function updateCoinDisplay() {
+ coinDisplay.setText('Coins: ' + Math.floor(coins));
+ // Update upgrade button states
+ for (var i = 0; i < upgradeButtons.length; i++) {
+ upgradeButtons[i].updateDisplay();
+ }
+ // Save progress
+ storage.coins = coins;
+ storage.totalClicks = totalClicks;
+ storage.betterClickCost = upgrades[0].cost;
+ storage.autoClickerCost = upgrades[1].cost;
+ storage.multiplierCost = upgrades[2].cost;
+ storage.autoPowerCost = upgrades[3].cost;
+}
+function createFloatingText(text, x, y) {
+ var floatingText = game.addChild(new FloatingText(text, x, y));
+ floatingTexts.push(floatingText);
+}
+// Auto clicker timer
+var autoClickerTimer = 0;
+// Initial display update
+updateCoinDisplay();
+for (var i = 0; i < upgradeButtons.length; i++) {
+ upgradeButtons[i].updateDisplay();
+}
+game.update = function () {
+ // Auto clicker functionality
+ if (autoClickerCount > 0) {
+ autoClickerTimer++;
+ if (autoClickerTimer >= 60) {
+ // Auto click every second (60 ticks)
+ autoClickerTimer = 0;
+ var autoEarnings = autoClickerCount * autoClickerPower;
+ coins += autoEarnings;
+ updateCoinDisplay();
+ // Show auto earning feedback occasionally
+ if (LK.ticks % 180 === 0) {
+ // Every 3 seconds
+ createFloatingText('+' + autoEarnings + ' (auto)', banana.x + 150, banana.y);
+ }
+ }
+ }
+ // Clean up destroyed floating texts
+ for (var i = floatingTexts.length - 1; i >= 0; i--) {
+ if (!floatingTexts[i].parent) {
+ floatingTexts.splice(i, 1);
+ }
+ }
+};
\ No newline at end of file
A yellow button. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Banana crystal . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Banana rainbow . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Mini banana. In-Game asset. 2d. High contrast. No shadows
Banana golden. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
relaxing banana tree landscape. In-Game asset. 2d. High contrast. No shadows