User prompt
There is a very small chance that colorful fruits will appear and the price will increase 3 times. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
It's too big now, shrink a little
User prompt
Add animation to "!" signs so they grow and shrink to attract more attention and make the "!" sign a little bigger ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
make the "!" sign on the plants a little bigger and Now when we plant the plants, let them be small and grow slowly, then collect them when they grow. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Enlarge seed shop screen and move the "seed" and "sell" buttons down a bit
User prompt
Move the "sell" and "seed" buttons a little more to the right and make them a little bigger.
User prompt
Move the "sell" and "seed" keys a little to the right
User prompt
Put the "sell" and "seed" keys next to the $ counter
User prompt
Make the "!" sign bigger
Code edit (1 edits merged)
Please save this source code
User prompt
Garden Harvest Tycoon
Initial prompt
Make a game like Banan Grow a Garden There should be 2 buttons, one with "sell" and if we pressh "seed" we sell all the plants. if we press "seed" A big seed shop will appear on the screen and there will be 5 seeds. 1) carrot price is 10$ 2) strawberry price 50$ 3) banana price 80$ 4) Coconut price is 160$ 5) dragon fruit $250 And add $ counter to the game When we start the game we have 2 carrots When you click on them, they go to our inventory and we sell them. The selling prices are 1)carrots $10 2)Strawberries $20 3)banana $50 4)Coconut $110 5)dragon fruit $200. and a brown dirt area to add them and when we plant a fruit, we wait for it to grow a little When it grows up, it will have "!" on it and we can buy and sell it.
/**** * Classes ****/ var Button = Container.expand(function (text, onClick) { var self = Container.call(this); var buttonBg = self.attachAsset('button', { anchorX: 0.5, anchorY: 0.5 }); var buttonText = new Text2(text, { size: 30, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.down = function () { if (onClick) onClick(); }; return self; }); var PlantSpot = Container.expand(function (x, y) { var self = Container.call(this); self.x = x; self.y = y; self.planted = false; self.plantType = null; self.plantTime = 0; self.grown = false; var dirtGraphics = self.attachAsset('dirt', { anchorX: 0.5, anchorY: 0.5 }); var plantGraphics = null; var exclamationText = null; self.plantSeed = function (seedType) { if (self.planted) return false; self.planted = true; self.plantType = seedType; self.plantTime = LK.ticks; self.grown = false; plantGraphics = self.attachAsset(seedType, { anchorX: 0.5, anchorY: 0.5, alpha: 0.5 }); LK.getSound('plant').play(); return true; }; self.harvest = function () { if (!self.grown) return null; var harvestedType = self.plantType; if (plantGraphics) { plantGraphics.destroy(); plantGraphics = null; } if (exclamationText) { exclamationText.destroy(); exclamationText = null; } self.planted = false; self.plantType = null; self.plantTime = 0; self.grown = false; LK.getSound('harvest').play(); return harvestedType; }; self.update = function () { if (self.planted && !self.grown) { if (LK.ticks - self.plantTime > 300) { // 5 seconds at 60fps self.grown = true; if (plantGraphics) { plantGraphics.alpha = 1.0; } exclamationText = new Text2('!', { size: 80, fill: 0xFF0000 }); exclamationText.anchor.set(0.5, 0.5); exclamationText.x = 0; exclamationText.y = -60; self.addChild(exclamationText); } } }; self.down = function () { if (self.grown) { var harvested = self.harvest(); if (harvested) { inventory[harvested] = (inventory[harvested] || 0) + 1; updateInventoryDisplay(); } } else if (!self.planted && selectedSeed && money >= seedPrices[selectedSeed]) { if (self.plantSeed(selectedSeed)) { money -= seedPrices[selectedSeed]; updateMoneyDisplay(); selectedSeed = null; seedShop.visible = false; } } }; return self; }); var SeedShop = Container.expand(function () { var self = Container.call(this); var background = self.attachAsset('seedShopBg', { anchorX: 0.5, anchorY: 0.5 }); var titleText = new Text2('SEED SHOP', { size: 60, fill: 0x000000 }); titleText.anchor.set(0.5, 0.5); titleText.y = -600; self.addChild(titleText); var seedTypes = ['carrot', 'strawberry', 'banana', 'coconut', 'dragonfruit']; var seedNames = ['Carrot', 'Strawberry', 'Banana', 'Coconut', 'Dragon Fruit']; for (var i = 0; i < seedTypes.length; i++) { var seedButton = new Container(); seedButton.x = 0; seedButton.y = -400 + i * 150; var seedIcon = LK.getAsset(seedTypes[i], { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 }); seedIcon.x = -300; seedButton.addChild(seedIcon); var nameText = new Text2(seedNames[i], { size: 40, fill: 0x000000 }); nameText.anchor.set(0, 0.5); nameText.x = -200; seedButton.addChild(nameText); var priceText = new Text2('$' + seedPrices[seedTypes[i]], { size: 40, fill: 0x006400 }); priceText.anchor.set(1, 0.5); priceText.x = 300; seedButton.addChild(priceText); seedButton.seedType = seedTypes[i]; seedButton.down = function () { if (money >= seedPrices[this.seedType]) { selectedSeed = this.seedType; self.visible = false; } }; self.addChild(seedButton); } var closeButton = new Button('CLOSE', function () { self.visible = false; }); closeButton.y = 500; self.addChild(closeButton); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ var money = 0; var inventory = {}; var selectedSeed = null; var seedPrices = { carrot: 10, strawberry: 50, banana: 80, coconut: 160, dragonfruit: 250 }; var sellPrices = { carrot: 10, strawberry: 20, banana: 50, coconut: 110, dragonfruit: 200 }; // Create plant spots in a grid var plantSpots = []; var gridCols = 8; var gridRows = 10; var startX = 300; var startY = 400; var spacing = 220; for (var row = 0; row < gridRows; row++) { for (var col = 0; col < gridCols; col++) { var spot = new PlantSpot(startX + col * spacing, startY + row * spacing); plantSpots.push(spot); game.addChild(spot); } } // Plant initial carrots plantSpots[0].plantSeed('carrot'); plantSpots[1].plantSeed('carrot'); // UI Elements var moneyText = new Text2('Money: $0', { size: 50, fill: 0x000000 }); moneyText.anchor.set(0, 0); moneyText.x = 150; moneyText.y = 50; LK.gui.topLeft.addChild(moneyText); var inventoryText = new Text2('Inventory: Empty', { size: 30, fill: 0x000000 }); inventoryText.anchor.set(0, 0); inventoryText.x = 150; inventoryText.y = 120; LK.gui.topLeft.addChild(inventoryText); var sellButton = new Button('SELL ALL', function () { var totalSale = 0; for (var itemType in inventory) { if (inventory[itemType] > 0) { totalSale += inventory[itemType] * sellPrices[itemType]; inventory[itemType] = 0; } } if (totalSale > 0) { money += totalSale; updateMoneyDisplay(); updateInventoryDisplay(); LK.getSound('sell').play(); } }); sellButton.x = 500; sellButton.y = 50; LK.gui.topLeft.addChild(sellButton); var seedButton = new Button('SEEDS', function () { seedShop.visible = true; }); seedButton.x = 750; seedButton.y = 50; LK.gui.topLeft.addChild(seedButton); var seedShop = new SeedShop(); seedShop.x = 1024; seedShop.y = 1366; seedShop.visible = false; game.addChild(seedShop); function updateMoneyDisplay() { moneyText.setText('Money: $' + money); } function updateInventoryDisplay() { var inventoryStr = 'Inventory: '; var hasItems = false; for (var itemType in inventory) { if (inventory[itemType] > 0) { if (hasItems) inventoryStr += ', '; inventoryStr += itemType + ' x' + inventory[itemType]; hasItems = true; } } if (!hasItems) { inventoryStr += 'Empty'; } inventoryText.setText(inventoryStr); } game.update = function () { // Plant spots update automatically through their update methods };
===================================================================
--- original.js
+++ change.js
@@ -234,15 +234,15 @@
updateInventoryDisplay();
LK.getSound('sell').play();
}
});
-sellButton.x = 450;
+sellButton.x = 500;
sellButton.y = 50;
LK.gui.topLeft.addChild(sellButton);
var seedButton = new Button('SEEDS', function () {
seedShop.visible = true;
});
-seedButton.x = 700;
+seedButton.x = 750;
seedButton.y = 50;
LK.gui.topLeft.addChild(seedButton);
var seedShop = new SeedShop();
seedShop.x = 1024;
8 bit dragon fruit tree. In-Game asset. 2d. High contrast. No shadows
8 bit carrot. In-Game asset. 2d. High contrast. No shadows
background grass 8 bit. In-Game asset. 2d. High contrast. No shadows
8 bit Straw berry. In-Game asset. 2d. High contrast. No shadows
8 bit banana tree. In-Game asset. 2d. High contrast. No shadows
8 bit coconut tree. In-Game asset. 2d. High contrast. No shadows
Neon
Neon
Neon
Neon
Neon
Stone 8 bit. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
8 bit fish. In-Game asset. 2d. High contrast. No shadows
Neon
8 bit orange. In-Game asset. 2d. High contrast. No shadows
Neon
Apple tree 8 bit. In-Game asset. 2d. High contrast. No shadows
Choco
Choco but all parts of the carrot are visible and only the carrot is painted brown
Neon
different color