User prompt
When our money is 450, increase the price of all eggs by 150
User prompt
- **T-Rex (22)**: 30 coins every 3 seconds = **8.33 coins/second** - **Triceratops (23)**: 20 coins every 3.5 seconds = **6.57 coins/second** - **Stegosaurus (24)**: 25 coins every 4 seconds = **5.25 coins/second** - **Brontosaurus (25)**: 23 coins every 2.5 seconds = **11.20 coins/second** - **Velociraptor (26)**: 21 coins every 3.8 seconds = **6.32 coins/second** - **Pteranodon (27)**: 20 coins every 3.2 seconds = **8.13 coins/second**
User prompt
Shorten the background of the eggs a little bit, it blends in with the background of the animals
User prompt
Leave some space between the animals and the area
User prompt
but it didn't work, fix it
User prompt
Set the hatching background of the eggs to "grass"
User prompt
Since there is already a background there, delete it.
User prompt
Add a background for the part where the eggs hatch
User prompt
Put the buy dragon egg button under the buy mystery egg
User prompt
Put the buy dragon egg button next to the buy mystery egg button
User prompt
Place the dinosaur egg pick-up button next to the dragon egg pick-up button. and put the dragon egg receiving button under the mystery egg receiving button
User prompt
Put the dinosaur egg purchase button under the buy egg button
User prompt
Add dinosaur eggs to the game and add 6 different dinosaurs and as an extra add a new dragon that can come out of dragon egg
User prompt
remove elephant egg from game
User prompt
Add a new egg next to the dragon egg and add different animals, the price will be 150, and the price will increase by 100 each time we buy it.
User prompt
When our money is 150, the price of the egg we buy increases by 55 for every egg we buy.
User prompt
remove the money arrival counter under the money
User prompt
When our money reaches 100, increase the price of all eggs by 35
User prompt
Set the money incoming counter to 4 seconds
User prompt
add background where the eggs are
User prompt
Increase the size of the egg hatching time and place it on the egg
User prompt
Make the eggs text black
User prompt
Delete the egg carm tycoon text above and delete the text below it tap eggs to hatch them
User prompt
Write next to our money how much money comes in per second
User prompt
## Current Hatching Times: - **Regular Eggs**: 6 seconds - **Dragon Eggs**: 15 seconds - **Mystery Eggs**: 10 seconds
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Animal = Container.expand(function (type) { var self = Container.call(this); self.type = type; self.lastEarningTime = LK.ticks; self.isMoving = false; // Track if animal is currently moving // Animal types: 0=chicken, 1=cow, 2=pig, 3=sheep, 4=horse, 5=goat, 6=duck, 7=rabbit, 8=bear, 9=fox, 10=turkey, 11=iceDragon, 12=darkDragon, 13=goldenDragon, 14=elephant, 15=lion, 16=tiger, 17=giraffe, 18=zebra, 19=hippo, 20=rhino, 21=panda var assetNames = ['chicken', 'cow', 'pig', 'sheep', 'horse', 'goat', 'duck', 'rabbit', 'bear', 'fox', 'turkey', 'iceDragon', 'darkDragon', 'goldenDragon', 'elephant', 'lion', 'tiger', 'giraffe', 'zebra', 'hippo', 'rhino', 'panda']; var earningRates = [1, 2, 4, 6, 7, 8, 9, 9, 10, 11, 1, 13, 15, 12, 14, 16, 18, 15, 17, 19, 20, 22]; // coins per cycle - updated turkey to 1 coin var earningCycles = [5.26, 5.13, 4.44, 6, 6, 6, 6, 5, 4.5, 5.73, 7.75, 2.96, 2.73, 1.25, 4, 5, 4.5, 5.5, 5, 4, 3.5, 3]; // seconds between earnings - updated cycles var animalGraphics = self.attachAsset(assetNames[type], { anchorX: 0.5, anchorY: 0.5 }); self.earningRate = earningRates[type]; self.earningCycle = earningCycles[type] * 60; // Convert seconds to ticks (60fps) // Special turkey variants (10% chance for golden turkey, 5% chance for golden fox) if (type === 10) { // Turkey var turkeyRandom = Math.random(); if (turkeyRandom < 0.1) { // 10% chance for golden turkey (17 coins) self.earningRate = 17; // Tint golden animalGraphics.tint = 0xFFD700; } } else if (type === 9) { // Fox var foxRandom = Math.random(); if (foxRandom < 0.05) { // 5% chance for golden fox (15 coins) self.earningRate = 15; self.earningCycle = 5.73 * 60; // 5.73 seconds converted to ticks // Tint golden animalGraphics.tint = 0xFFD700; } } self.update = function () { // Generate coins based on animal-specific cycle if (LK.ticks - self.lastEarningTime >= self.earningCycle) { self.generateCoins(); self.lastEarningTime = LK.ticks; } // Random wandering movement if (!self.isMoving && Math.random() < 0.01) { // 1% chance per frame to start moving self.startWandering(); } }; self.generateCoins = function () { coins += self.earningRate; updateCoinDisplay(); // Visual feedback - coin animation var coinEffect = new CoinEffect(); coinEffect.x = self.x; coinEffect.y = self.y - 50; game.addChild(coinEffect); LK.getSound('coinCollect').play(); }; self.startWandering = function () { self.isMoving = true; // Calculate random target position within grass bounds // Grass is positioned at x=1024, y=1200 with width=2048, height=800 // So grass bounds are: left=0, right=2048, top=1200, bottom=2000 var grassLeft = 50; // Small margin from edges var grassRight = 1998; // Small margin from edges var grassTop = 1250; // Small margin from top var grassBottom = 1950; // Small margin from bottom var targetX = grassLeft + Math.random() * (grassRight - grassLeft); var targetY = grassTop + Math.random() * (grassBottom - grassTop); // Calculate distance for duration (further = longer time) var distance = Math.sqrt((targetX - self.x) * (targetX - self.x) + (targetY - self.y) * (targetY - self.y)); var duration = Math.max(1000, distance * 3); // Minimum 1 second, scaled by distance tween(self, { x: targetX, y: targetY }, { duration: duration, easing: tween.easeInOut, onFinish: function onFinish() { self.isMoving = false; } }); }; return self; }); var CoinEffect = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); // Animate coin floating up and fading out tween(self, { y: self.y - 100, alpha: 0 }, { duration: 1000, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); return self; }); var DragonEgg = Container.expand(function () { var self = Container.call(this); var eggGraphics = self.attachAsset('dragonEgg', { anchorX: 0.5, anchorY: 0.5 }); self.isHatched = false; self.isHatching = false; self.hatchCountdown = 0; // Create countdown text (initially hidden) var countdownText = new Text2('15', { size: 40, fill: 0xFF0000 }); countdownText.anchor.set(0.5, 0.5); countdownText.y = -120; countdownText.visible = false; self.addChild(countdownText); self.down = function (x, y, obj) { if (!self.isHatched && !self.isHatching) { self.startHatching(); } }; self.update = function () { if (self.isHatching && self.hatchCountdown > 0) { self.hatchCountdown--; var secondsLeft = Math.ceil(self.hatchCountdown / 60); countdownText.setText(secondsLeft.toString()); if (self.hatchCountdown <= 0) { self.hatch(); } } }; self.startHatching = function () { if (self.isHatching || self.isHatched) { return; } self.isHatching = true; self.hatchCountdown = 900; // 15 seconds at 60fps countdownText.visible = true; countdownText.setText('15'); // Animate countdown text appearance tween(countdownText, { scaleX: 1.5, scaleY: 1.5 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(countdownText, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeIn }); } }); }; self.hatch = function () { if (self.isHatched) { return; } self.isHatched = true; self.isHatching = false; countdownText.visible = false; LK.getSound('hatch').play(); // Dragon type selection with golden dragon rare spawn var dragonType; var randomValue = Math.random(); if (randomValue < 0.009) { // 0.9% chance for golden dragon dragonType = 13; // Golden dragon } else if (randomValue < 0.5) { // 50% chance for ice dragon dragonType = 11; // Ice dragon } else { // 34% chance for dark dragon dragonType = 12; // Dark dragon } var dragon = new Animal(dragonType); // Position dragon randomly on grass dragon.x = 200 + Math.random() * 1600; // Random X position across grass width dragon.y = 1250 + Math.random() * 700; // Random Y position on grass area // Add dragon to game and animals array game.addChild(dragon); animals.push(dragon); // Remove dragon egg from game and eggs array var eggIndex = eggs.indexOf(self); if (eggIndex !== -1) { eggs.splice(eggIndex, 1); } self.destroy(); }; return self; }); var DragonShopButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('shopButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); buttonGraphics.tint = 0x8B008B; // Purple color for dragon button var buttonText = new Text2('Buy Dragon Egg (' + dragonEggPrice + ' coins)', { size: 22, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function (x, y, obj) { if (coins >= dragonEggPrice) { self.purchaseDragonEgg(); } }; self.purchaseDragonEgg = function () { coins -= dragonEggPrice; dragonEggPrice += 20; updateCoinDisplay(); // Update button text with new price buttonText.setText('Buy Dragon Egg (' + dragonEggPrice + ' coins)'); LK.getSound('purchase').play(); // Create new dragon egg and add to game var newDragonEgg = new DragonEgg(); // Position dragon egg in egg area grid layout var gridX = eggs.length % 5; var gridY = Math.floor(eggs.length / 5); newDragonEgg.x = 200 + gridX * 120; newDragonEgg.y = 600 + gridY * 180; game.addChild(newDragonEgg); eggs.push(newDragonEgg); // Flash button purple LK.effects.flashObject(self, 0xFF00FF, 500); }; return self; }); var Egg = Container.expand(function () { var self = Container.call(this); var eggGraphics = self.attachAsset('egg', { anchorX: 0.5, anchorY: 0.5 }); self.isHatched = false; self.isHatching = false; self.hatchCountdown = 0; // Create countdown text (initially hidden) var countdownText = new Text2('6', { size: 40, fill: 0xFF0000 }); countdownText.anchor.set(0.5, 0.5); countdownText.y = -100; countdownText.visible = false; self.addChild(countdownText); self.down = function (x, y, obj) { if (!self.isHatched && !self.isHatching) { self.startHatching(); } }; self.update = function () { if (self.isHatching && self.hatchCountdown > 0) { self.hatchCountdown--; var secondsLeft = Math.ceil(self.hatchCountdown / 60); countdownText.setText(secondsLeft.toString()); if (self.hatchCountdown <= 0) { self.hatch(); } } }; self.startHatching = function () { if (self.isHatching || self.isHatched) { return; } self.isHatching = true; self.hatchCountdown = 360; // 6 seconds at 60fps countdownText.visible = true; countdownText.setText('6'); // Animate countdown text appearance tween(countdownText, { scaleX: 1.5, scaleY: 1.5 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(countdownText, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeIn }); } }); }; self.hatch = function () { if (self.isHatched) { return; } self.isHatched = true; self.isHatching = false; countdownText.visible = false; LK.getSound('hatch').play(); // Random animal type (0-10) - now includes bear, fox, and turkey var animalType = Math.floor(Math.random() * 11); var animal = new Animal(animalType); // Position animal randomly on grass animal.x = 200 + Math.random() * 1600; // Random X position across grass width animal.y = 1250 + Math.random() * 700; // Random Y position on grass area // Add animal to game and animals array game.addChild(animal); animals.push(animal); // Remove egg from game and eggs array var eggIndex = eggs.indexOf(self); if (eggIndex !== -1) { eggs.splice(eggIndex, 1); } self.destroy(); }; return self; }); var MysteryEgg = Container.expand(function () { var self = Container.call(this); var eggGraphics = self.attachAsset('mysteryEgg', { anchorX: 0.5, anchorY: 0.5 }); // Tint mystery egg with purple color eggGraphics.tint = 0x9932CC; self.isHatched = false; self.isHatching = false; self.hatchCountdown = 0; // Create countdown text (initially hidden) var countdownText = new Text2('10', { size: 40, fill: 0xFF0000 }); countdownText.anchor.set(0.5, 0.5); countdownText.y = -100; countdownText.visible = false; self.addChild(countdownText); self.down = function (x, y, obj) { if (!self.isHatched && !self.isHatching) { self.startHatching(); } }; self.update = function () { if (self.isHatching && self.hatchCountdown > 0) { self.hatchCountdown--; var secondsLeft = Math.ceil(self.hatchCountdown / 60); countdownText.setText(secondsLeft.toString()); if (self.hatchCountdown <= 0) { self.hatch(); } } }; self.startHatching = function () { if (self.isHatching || self.isHatched) { return; } self.isHatching = true; self.hatchCountdown = 600; // 10 seconds at 60fps countdownText.visible = true; countdownText.setText('10'); // Animate countdown text appearance tween(countdownText, { scaleX: 1.5, scaleY: 1.5 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(countdownText, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeIn }); } }); }; self.hatch = function () { if (self.isHatched) { return; } self.isHatched = true; self.isHatching = false; countdownText.visible = false; LK.getSound('hatch').play(); // Mystery egg hatches into one of 8 new animals (14-21) var animalType = 14 + Math.floor(Math.random() * 8); var animal = new Animal(animalType); // Position animal randomly on grass animal.x = 200 + Math.random() * 1600; // Random X position across grass width animal.y = 1250 + Math.random() * 700; // Random Y position on grass area // Add animal to game and animals array game.addChild(animal); animals.push(animal); // Remove mystery egg from game and eggs array var eggIndex = eggs.indexOf(self); if (eggIndex !== -1) { eggs.splice(eggIndex, 1); } self.destroy(); }; return self; }); var MysteryShopButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('shopButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); buttonGraphics.tint = 0x9932CC; // Purple color for mystery button var buttonText = new Text2('Buy Mystery Egg (' + mysteryEggPrice + ' coins)', { size: 20, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function (x, y, obj) { if (coins >= mysteryEggPrice) { self.purchaseMysteryEgg(); } }; self.purchaseMysteryEgg = function () { coins -= mysteryEggPrice; mysteryEggPrice += 15; updateCoinDisplay(); // Update button text with new price buttonText.setText('Buy Mystery Egg (' + mysteryEggPrice + ' coins)'); LK.getSound('purchase').play(); // Create new mystery egg and add to game var newMysteryEgg = new MysteryEgg(); // Position mystery egg in egg area grid layout var gridX = eggs.length % 5; var gridY = Math.floor(eggs.length / 5); newMysteryEgg.x = 200 + gridX * 120; newMysteryEgg.y = 600 + gridY * 180; game.addChild(newMysteryEgg); eggs.push(newMysteryEgg); // Flash button purple LK.effects.flashObject(self, 0xFF00FF, 500); }; return self; }); var ShopButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('shopButton', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); var buttonText = new Text2('Buy Egg (' + eggPrice + ' coins)', { size: 24, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function (x, y, obj) { if (coins >= eggPrice) { self.purchaseEgg(); } }; self.purchaseEgg = function () { coins -= eggPrice; eggPrice += 10; updateCoinDisplay(); // Update button text with new price buttonText.setText('Buy Egg (' + eggPrice + ' coins)'); LK.getSound('purchase').play(); // Create new egg and add to game var newEgg = new Egg(); // Position egg in egg area grid layout var gridX = eggs.length % 5; var gridY = Math.floor(eggs.length / 5); newEgg.x = 200 + gridX * 120; newEgg.y = 600 + gridY * 180; game.addChild(newEgg); eggs.push(newEgg); // Flash button green LK.effects.flashObject(self, 0x00FF00, 500); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x006400 }); /**** * Game Code ****/ // Game variables var coins = 0; var eggs = []; var animals = []; var eggPrice = 25; var dragonEggPrice = 65; var mysteryEggPrice = 45; // UI elements var coinDisplay = new Text2('Coins: 0', { size: 60, fill: 0xFFD700 }); coinDisplay.anchor.set(0.5, 0); LK.gui.top.addChild(coinDisplay); // Money per second display var moneyPerSecDisplay = new Text2('0.00/sec', { size: 40, fill: 0xFFD700 }); moneyPerSecDisplay.anchor.set(0.5, 0); moneyPerSecDisplay.y = 60; LK.gui.top.addChild(moneyPerSecDisplay); var titleText = new Text2('Egg Farm Tycoon', { size: 80, fill: 0x228B22 }); titleText.anchor.set(0.5, 0); titleText.x = 1024; titleText.y = 100; game.addChild(titleText); // Shop button var shopButton = new ShopButton(); shopButton.x = 1348; shopButton.y = 2450; shopButton.scaleX = 1.5; shopButton.scaleY = 1.5; game.addChild(shopButton); // Dragon shop button var dragonShopButton = new DragonShopButton(); dragonShopButton.x = 1024; dragonShopButton.y = 2650; dragonShopButton.scaleX = 1.5; dragonShopButton.scaleY = 1.5; game.addChild(dragonShopButton); // Mystery shop button var mysteryShopButton = new MysteryShopButton(); mysteryShopButton.x = 700; mysteryShopButton.y = 2450; mysteryShopButton.scaleX = 1.5; mysteryShopButton.scaleY = 1.5; game.addChild(mysteryShopButton); // Instructions var instructText = new Text2('Tap eggs to hatch them!', { size: 40, fill: 0x333333 }); instructText.anchor.set(0.5, 0); instructText.x = 1024; instructText.y = 200; game.addChild(instructText); // Egg area label var eggAreaLabel = new Text2('EGGS', { size: 50, fill: 0x8B4513 }); eggAreaLabel.anchor.set(0.5, 0); eggAreaLabel.x = 500; eggAreaLabel.y = 500; game.addChild(eggAreaLabel); // Add grass background for animals var grassBackground = LK.getAsset('grass', { anchorX: 0.5, anchorY: 0 }); grassBackground.x = 1024; grassBackground.y = 1200; game.addChild(grassBackground); // Animal area label var animalAreaLabel = new Text2('ANIMALS ON GRASS', { size: 50, fill: 0xFFFFFF }); animalAreaLabel.anchor.set(0.5, 0); animalAreaLabel.x = 1024; animalAreaLabel.y = 1100; game.addChild(animalAreaLabel); // Create initial 2 eggs in egg area for (var i = 0; i < 2; i++) { var egg = new Egg(); egg.x = 200 + i % 5 * 120; egg.y = 600 + Math.floor(i / 5) * 180; game.addChild(egg); eggs.push(egg); } function calculateMoneyPerSecond() { var totalPerSecond = 0; for (var i = 0; i < animals.length; i++) { var animal = animals[i]; var coinsPerSecond = animal.earningRate / (animal.earningCycle / 60); totalPerSecond += coinsPerSecond; } return totalPerSecond; } function updateCoinDisplay() { coinDisplay.setText('Coins: ' + coins); var moneyPerSec = calculateMoneyPerSecond(); moneyPerSecDisplay.setText(moneyPerSec.toFixed(2) + '/sec'); storage.coins = coins; } // Initialize coin display updateCoinDisplay(); // Start background music LK.playMusic('farmMusic'); game.update = function () { // Update shop button affordability if (coins >= eggPrice) { shopButton.alpha = 1.0; } else { shopButton.alpha = 0.6; } // Update dragon shop button affordability if (coins >= dragonEggPrice) { dragonShopButton.alpha = 1.0; } else { dragonShopButton.alpha = 0.6; } // Update mystery shop button affordability if (coins >= mysteryEggPrice) { mysteryShopButton.alpha = 1.0; } else { mysteryShopButton.alpha = 0.6; } };
===================================================================
--- original.js
+++ change.js
@@ -525,8 +525,16 @@
fill: 0xFFD700
});
coinDisplay.anchor.set(0.5, 0);
LK.gui.top.addChild(coinDisplay);
+// Money per second display
+var moneyPerSecDisplay = new Text2('0.00/sec', {
+ size: 40,
+ fill: 0xFFD700
+});
+moneyPerSecDisplay.anchor.set(0.5, 0);
+moneyPerSecDisplay.y = 60;
+LK.gui.top.addChild(moneyPerSecDisplay);
var titleText = new Text2('Egg Farm Tycoon', {
size: 80,
fill: 0x228B22
});
@@ -597,10 +605,21 @@
egg.y = 600 + Math.floor(i / 5) * 180;
game.addChild(egg);
eggs.push(egg);
}
+function calculateMoneyPerSecond() {
+ var totalPerSecond = 0;
+ for (var i = 0; i < animals.length; i++) {
+ var animal = animals[i];
+ var coinsPerSecond = animal.earningRate / (animal.earningCycle / 60);
+ totalPerSecond += coinsPerSecond;
+ }
+ return totalPerSecond;
+}
function updateCoinDisplay() {
coinDisplay.setText('Coins: ' + coins);
+ var moneyPerSec = calculateMoneyPerSecond();
+ moneyPerSecDisplay.setText(moneyPerSec.toFixed(2) + '/sec');
storage.coins = coins;
}
// Initialize coin display
updateCoinDisplay();
Tavuk pixel. In-Game asset. 2d. High contrast. No shadows
Inek pixel. In-Game asset. 2d. High contrast. No shadows
Domuz pixel. In-Game asset. 2d. High contrast. No shadows
Koyun pixel. In-Game asset. 2d. High contrast. No shadows
Egg pixel. In-Game asset. 2d. High contrast. No shadows
rabbit pixel. In-Game asset. 2d. High contrast. No shadows
Ordek pixel. In-Game asset. 2d. High contrast. No shadows
Dragon egg pixel. In-Game asset. 2d. High contrast. No shadows
Goat pixel. In-Game asset. 2d. High contrast. No shadows
Horse pixel. In-Game asset. 2d. High contrast. No shadows
DARK DRAGON PIXEL. In-Game asset. 2d. High contrast. No shadows
Ice dragon pixel. In-Game asset. 2d. High contrast. No shadows
Pixel
Turkey Pixel. In-Game asset. 2d. High contrast. No shadows
Bear pixel. In-Game asset. 2d. High contrast. No shadows
Fox pixel. In-Game asset. 2d. High contrast. No shadows
Coin pixel. In-Game asset. 2d. High contrast. No shadows
Elephant 8 bit. In-Game asset. 2d. High contrast. No shadows
Lion 8 bit. In-Game asset. 2d. High contrast. No shadows
Giraffe 8 bit. In-Game asset. 2d. High contrast. No shadows
Tiger 8 bit. In-Game asset. 2d. High contrast. No shadows
Zebra 8bit. In-Game asset. 2d. High contrast. No shadows
Panda 8bit. In-Game asset. 2d. High contrast. No shadows
Rhino 8bit. In-Game asset. 2d. High contrast. No shadows
T rex pixel. In-Game asset. 2d. High contrast. No shadows
Triceraptos pixel. In-Game asset. 2d. High contrast. No shadows
Stegosaurus pixel. In-Game asset. 2d. High contrast. No shadows
Brontosaurus pixel. In-Game asset. 2d. High contrast. No shadows
Veliciraptor pixel. In-Game asset. 2d. High contrast. No shadows
Pteranodon pixel. In-Game asset. 2d. High contrast. No shadows
Hippo 8 bit. In-Game asset. 2d. High contrast. No shadows