User prompt
make it in the order of watering can, sprinkler, good sprinkler, great sprinkler, mega sprinkler
User prompt
Get rid of the pond and make a tool shop (EG sprinkler, water can, mega sprinkler ECT ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
you can only put the pond plants on the pond
User prompt
delete the level
User prompt
300 dollars for level 3, 400 for level 4, 500 for level 5 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
if you have 200 dollars you go to level 2 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
add levels. with levels you can unlock stuff. level 1 has carrot, strawberry. level 2 has blueberry, corn. level 3 has tulip, tomato, daffodil. level 4 has watermelon, fanmade shop. level 5 has pond shop ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
make the garden and pond downer
User prompt
add a pond next to your garden and add a pond shop. there's seaweed, olded seaweed, kelp in side of the pond shop
User prompt
when you sell a plant will give you times 2 more money than it costs
User prompt
candy corn is $18 thousand
User prompt
pink pineapple is $11 thousand
User prompt
can you make the FANMADE shop a other button
User prompt
can you add a new type of shop called FANMADE and add pink pineapple and candy corn
User prompt
please make a restart button to restart your progress ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
please make the cost of all the seeds times 2
User prompt
make daffodil $51 and watermelon $68
User prompt
add daffodil and watermelon
User prompt
make the corn $39 and the tulip $41 and the tomato $45
User prompt
can you add corn between blueberry and tulip
User prompt
delete orange
User prompt
can you add orange tulip and tomato
User prompt
if you press the shop button again the shop will go
User prompt
can you make it so when you open the shop please make the shop background over layer the garden
Code edit (1 edits merged)
Please save this source code
/**** * Plugins ****/ var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var GardenPlot = Container.expand(function () { var self = Container.call(this); var plotGraphics = self.attachAsset('gardenPlot', { anchorX: 0.5, anchorY: 0.5 }); self.cropType = null; self.plantTime = 0; self.growthStage = 0; // 0 = empty, 1 = seed, 2 = sprout, 3 = mature self.cropAsset = null; self.plantSeed = function (seedType) { if (self.growthStage > 0) return false; self.cropType = seedType; self.plantTime = LK.ticks; self.growthStage = 1; plotGraphics.tint = 0x654321; var seedAssetName = seedType + 'Seed'; self.cropAsset = self.attachAsset(seedAssetName, { anchorX: 0.5, anchorY: 0.5 }); LK.getSound('plant').play(); return true; }; self.harvest = function () { if (self.growthStage !== 3) return null; var harvestedCrop = self.cropType; self.cropType = null; self.plantTime = 0; self.growthStage = 0; plotGraphics.tint = 0xFFFFFF; if (self.cropAsset) { self.removeChild(self.cropAsset); self.cropAsset = null; } LK.getSound('harvest').play(); return harvestedCrop; }; self.update = function () { if (self.growthStage === 0 || !self.cropType) return; var growthTime = LK.ticks - self.plantTime; var cropData = getCropData(self.cropType); if (self.growthStage === 1 && growthTime >= cropData.sproutTime) { self.growthStage = 2; if (self.cropAsset) { self.removeChild(self.cropAsset); } var sproutAssetName = self.cropType + 'Sprout'; self.cropAsset = self.attachAsset(sproutAssetName, { anchorX: 0.5, anchorY: 0.5 }); } else if (self.growthStage === 2 && growthTime >= cropData.matureTime) { self.growthStage = 3; if (self.cropAsset) { self.removeChild(self.cropAsset); } var cropAssetName = self.cropType + 'Crop'; self.cropAsset = self.attachAsset(cropAssetName, { anchorX: 0.5, anchorY: 0.5 }); } }; self.down = function (x, y, obj) { if (self.growthStage === 3) { var harvestedCrop = self.harvest(); if (harvestedCrop) { var cropData = getCropData(harvestedCrop); money += cropData.sellPrice; updateMoneyDisplay(); } } else if (self.growthStage === 0 && selectedSeed && inventory[selectedSeed] > 0) { if (self.plantSeed(selectedSeed)) { inventory[selectedSeed]--; updateInventoryDisplay(); } } }; return self; }); var ShopItem = Container.expand(function (cropType, yPos) { var self = Container.call(this); var buyButton = self.attachAsset('buyButton', { anchorX: 0.5, anchorY: 0.5 }); self.x = 300; self.y = yPos; var cropData = getCropData(cropType); var nameText = new Text2(cropData.name, { size: 40, fill: 0x000000 }); nameText.anchor.set(0.5, 0.5); nameText.x = -50; nameText.y = -15; self.addChild(nameText); var priceText = new Text2('$' + cropData.seedPrice, { size: 35, fill: 0x000000 }); priceText.anchor.set(0.5, 0.5); priceText.x = -50; priceText.y = 15; self.addChild(priceText); self.down = function (x, y, obj) { if (money >= cropData.seedPrice) { money -= cropData.seedPrice; inventory[cropType] = (inventory[cropType] || 0) + 1; selectedSeed = cropType; updateMoneyDisplay(); updateInventoryDisplay(); LK.getSound('purchase').play(); } }; return self; }); var ToolShopItem = Container.expand(function (toolType, yPos) { var self = Container.call(this); var buyButton = self.attachAsset('buyButton', { anchorX: 0.5, anchorY: 0.5 }); self.x = 300; self.y = yPos; var toolData = getToolData(toolType); var nameText = new Text2(toolData.name, { size: 40, fill: 0x000000 }); nameText.anchor.set(0.5, 0.5); nameText.x = -50; nameText.y = -15; self.addChild(nameText); var priceText = new Text2('$' + toolData.price, { size: 35, fill: 0x000000 }); priceText.anchor.set(0.5, 0.5); priceText.x = -50; priceText.y = 15; self.addChild(priceText); self.down = function (x, y, obj) { if (money >= toolData.price && !toolInventory[toolType]) { money -= toolData.price; toolInventory[toolType] = true; selectedTool = toolType; updateMoneyDisplay(); updateToolInventoryDisplay(); LK.getSound('purchase').play(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // UI elements // Seeds and crops // Garden plots // Game state var money = storage.money || 100; var inventory = storage.inventory || {}; var toolInventory = storage.toolInventory || {}; var selectedSeed = null; var selectedTool = null; var shopOpen = false; var fanmadeShopOpen = false; var toolShopOpen = false; // Crop data function getCropData(cropType) { var cropData = { 'carrot': { name: 'Carrot', seedPrice: 20, sellPrice: 40, sproutTime: 180, // 3 seconds matureTime: 300 // 5 seconds }, 'strawberry': { name: 'Strawberry', seedPrice: 40, sellPrice: 80, sproutTime: 300, // 5 seconds matureTime: 480 // 8 seconds }, 'blueberry': { name: 'Blueberry', seedPrice: 70, sellPrice: 140, sproutTime: 480, // 8 seconds matureTime: 720 // 12 seconds }, 'corn': { name: 'Corn', seedPrice: 78, sellPrice: 156, sproutTime: 360, // 6 seconds matureTime: 600 // 10 seconds }, 'tulip': { name: 'Tulip', seedPrice: 82, sellPrice: 164, sproutTime: 240, // 4 seconds matureTime: 420 // 7 seconds }, 'tomato': { name: 'Tomato', seedPrice: 90, sellPrice: 180, sproutTime: 420, // 7 seconds matureTime: 660 // 11 seconds }, 'daffodil': { name: 'Daffodil', seedPrice: 102, sellPrice: 204, sproutTime: 300, // 5 seconds matureTime: 480 // 8 seconds }, 'watermelon': { name: 'Watermelon', seedPrice: 136, sellPrice: 272, sproutTime: 600, // 10 seconds matureTime: 900 // 15 seconds }, 'pinkPineapple': { name: 'Pink Pineapple', seedPrice: 11000, sellPrice: 22000, sproutTime: 720, // 12 seconds matureTime: 1080 // 18 seconds }, 'candyCorn': { name: 'Candy Corn', seedPrice: 18000, sellPrice: 36000, sproutTime: 660, // 11 seconds matureTime: 960 // 16 seconds } }; return cropData[cropType]; } // Tool data function getToolData(toolType) { var toolData = { 'waterCan': { name: 'Watering Can', price: 100, description: 'Manually water individual crops' }, 'sprinkler': { name: 'Sprinkler', price: 200, description: 'Waters nearby crops faster' }, 'goodSprinkler': { name: 'Good Sprinkler', price: 300, description: 'Waters crops more efficiently' }, 'greatSprinkler': { name: 'Great Sprinkler', price: 400, description: 'Waters crops very efficiently' }, 'megaSprinkler': { name: 'Mega Sprinkler', price: 500, description: 'Waters all crops instantly' } }; return toolData[toolType]; } // UI setup var moneyText = new Text2('Money: $' + money, { size: 60, fill: 0xFFFFFF }); moneyText.anchor.set(0, 0); moneyText.x = 150; moneyText.y = 20; LK.gui.topLeft.addChild(moneyText); var inventoryText = new Text2('Seeds: 0', { size: 50, fill: 0xFFFFFF }); inventoryText.anchor.set(0.5, 0); LK.gui.top.addChild(inventoryText); var selectedSeedText = new Text2('Selected: None', { size: 45, fill: 0xFFFFFF }); selectedSeedText.anchor.set(1, 0); selectedSeedText.x = -20; selectedSeedText.y = 20; LK.gui.topRight.addChild(selectedSeedText); var toolInventoryText = new Text2('Tools: 0', { size: 50, fill: 0xFFFFFF }); toolInventoryText.anchor.set(0.5, 0); toolInventoryText.y = 60; LK.gui.top.addChild(toolInventoryText); var selectedToolText = new Text2('Tool: None', { size: 40, fill: 0xFFFFFF }); selectedToolText.anchor.set(1, 0); selectedToolText.x = -20; selectedToolText.y = 70; LK.gui.topRight.addChild(selectedToolText); // Shop button var shopButton = game.addChild(LK.getAsset('shopButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 150 })); var shopButtonText = new Text2('SHOP', { size: 50, fill: 0xFFFFFF }); shopButtonText.anchor.set(0.5, 0.5); shopButton.addChild(shopButtonText); // FANMADE shop button var fanmadeShopButton = game.addChild(LK.getAsset('fanmadeShopButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 250 })); var fanmadeShopButtonText = new Text2('FANMADE', { size: 45, fill: 0xFFFFFF }); fanmadeShopButtonText.anchor.set(0.5, 0.5); fanmadeShopButton.addChild(fanmadeShopButtonText); // Tool shop button var toolShopButton = game.addChild(LK.getAsset('toolShopButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 350 })); var toolShopButtonText = new Text2('TOOL SHOP', { size: 40, fill: 0xFFFFFF }); toolShopButtonText.anchor.set(0.5, 0.5); toolShopButton.addChild(toolShopButtonText); // Shop UI var shopContainer = new Container(); var shopBackground = shopContainer.addChild(LK.getAsset('shopBackground', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, scaleX: 3.5, scaleY: 2.0 })); var shopTitle = new Text2('SEED SHOP', { size: 60, fill: 0x000000 }); shopTitle.anchor.set(0.5, 0.5); shopTitle.x = 1024; shopTitle.y = 1000; shopContainer.addChild(shopTitle); var closeShopText = new Text2('Tap outside to close', { size: 40, fill: 0x666666 }); closeShopText.anchor.set(0.5, 0.5); closeShopText.x = 1024; closeShopText.y = 1700; shopContainer.addChild(closeShopText); // Shop items var carrotShopItem = shopContainer.addChild(new ShopItem('carrot', 1200)); var strawberryShopItem = shopContainer.addChild(new ShopItem('strawberry', 1300)); var blueberryShopItem = shopContainer.addChild(new ShopItem('blueberry', 1400)); var cornShopItem = shopContainer.addChild(new ShopItem('corn', 1500)); var tulipShopItem = shopContainer.addChild(new ShopItem('tulip', 1600)); var tomatoShopItem = shopContainer.addChild(new ShopItem('tomato', 1700)); var daffodilShopItem = shopContainer.addChild(new ShopItem('daffodil', 1800)); var watermelonShopItem = shopContainer.addChild(new ShopItem('watermelon', 1900)); // FANMADE Shop UI var fanmadeShopContainer = new Container(); var fanmadeShopBackground = fanmadeShopContainer.addChild(LK.getAsset('shopBackground', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, scaleX: 3.5, scaleY: 2.0 })); var fanmadeShopTitle = new Text2('FANMADE SHOP', { size: 60, fill: 0x000000 }); fanmadeShopTitle.anchor.set(0.5, 0.5); fanmadeShopTitle.x = 1024; fanmadeShopTitle.y = 1000; fanmadeShopContainer.addChild(fanmadeShopTitle); var closeFanmadeShopText = new Text2('Tap outside to close', { size: 40, fill: 0x666666 }); closeFanmadeShopText.anchor.set(0.5, 0.5); closeFanmadeShopText.x = 1024; closeFanmadeShopText.y = 1700; fanmadeShopContainer.addChild(closeFanmadeShopText); // FANMADE shop items var pinkPineappleShopItem = fanmadeShopContainer.addChild(new ShopItem('pinkPineapple', 1200)); var candyCornShopItem = fanmadeShopContainer.addChild(new ShopItem('candyCorn', 1300)); fanmadeShopContainer.visible = false; game.addChild(fanmadeShopContainer); // Tool Shop UI var toolShopContainer = new Container(); var toolShopBackground = toolShopContainer.addChild(LK.getAsset('shopBackground', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, scaleX: 3.5, scaleY: 2.0 })); var toolShopTitle = new Text2('TOOL SHOP', { size: 60, fill: 0x000000 }); toolShopTitle.anchor.set(0.5, 0.5); toolShopTitle.x = 1024; toolShopTitle.y = 1000; toolShopContainer.addChild(toolShopTitle); var closeToolShopText = new Text2('Tap outside to close', { size: 40, fill: 0x666666 }); closeToolShopText.anchor.set(0.5, 0.5); closeToolShopText.x = 1024; closeToolShopText.y = 1700; toolShopContainer.addChild(closeToolShopText); // Tool shop items var waterCanShopItem = toolShopContainer.addChild(new ToolShopItem('waterCan', 1200)); var sprinklerShopItem = toolShopContainer.addChild(new ToolShopItem('sprinkler', 1300)); var goodSprinklerShopItem = toolShopContainer.addChild(new ToolShopItem('goodSprinkler', 1400)); var greatSprinklerShopItem = toolShopContainer.addChild(new ToolShopItem('greatSprinkler', 1500)); var megaSprinklerShopItem = toolShopContainer.addChild(new ToolShopItem('megaSprinkler', 1600)); toolShopContainer.visible = false; game.addChild(toolShopContainer); shopContainer.visible = false; game.addChild(shopContainer); // Garden plots var plots = []; var plotRows = 6; var plotCols = 7; var plotSpacing = 200; var startX = 1024 - (plotCols - 1) * plotSpacing / 2; var startY = 700; for (var row = 0; row < plotRows; row++) { for (var col = 0; col < plotCols; col++) { var plot = game.addChild(new GardenPlot()); plot.x = startX + col * plotSpacing; plot.y = startY + row * plotSpacing; plots.push(plot); } } // Helper functions function updateMoneyDisplay() { moneyText.setText('Money: $' + money); storage.money = money; } function updateInventoryDisplay() { var totalSeeds = 0; for (var seedType in inventory) { totalSeeds += inventory[seedType]; } inventoryText.setText('Seeds: ' + totalSeeds); if (selectedSeed && inventory[selectedSeed] > 0) { var cropData = getCropData(selectedSeed); selectedSeedText.setText('Selected: ' + cropData.name + ' (' + inventory[selectedSeed] + ')'); } else { selectedSeedText.setText('Selected: None'); selectedSeed = null; } storage.inventory = inventory; } function updateToolInventoryDisplay() { var totalTools = 0; for (var toolType in toolInventory) { if (toolInventory[toolType]) totalTools++; } toolInventoryText.setText('Tools: ' + totalTools); if (selectedTool && toolInventory[selectedTool]) { var toolData = getToolData(selectedTool); selectedToolText.setText('Tool: ' + toolData.name); } else { selectedToolText.setText('Tool: None'); selectedTool = null; } storage.toolInventory = toolInventory; } // Shop button handler shopButton.down = function (x, y, obj) { if (shopOpen) { shopOpen = false; shopContainer.visible = false; } else { shopOpen = true; shopContainer.visible = true; } }; // FANMADE shop button handler fanmadeShopButton.down = function (x, y, obj) { if (fanmadeShopOpen) { fanmadeShopOpen = false; fanmadeShopContainer.visible = false; } else { fanmadeShopOpen = true; fanmadeShopContainer.visible = true; } }; // Tool shop button handler toolShopButton.down = function (x, y, obj) { if (toolShopOpen) { toolShopOpen = false; toolShopContainer.visible = false; } else { toolShopOpen = true; toolShopContainer.visible = true; } }; // Game click handler for closing shop game.down = function (x, y, obj) { if (shopOpen && obj === game) { shopOpen = false; shopContainer.visible = false; } if (fanmadeShopOpen && obj === game) { fanmadeShopOpen = false; fanmadeShopContainer.visible = false; } if (toolShopOpen && obj === game) { toolShopOpen = false; toolShopContainer.visible = false; } }; // Restart button var restartButton = game.addChild(LK.getAsset('restartButton', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 2600 })); var restartButtonText = new Text2('RESTART', { size: 45, fill: 0xFFFFFF }); restartButtonText.anchor.set(0.5, 0.5); restartButton.addChild(restartButtonText); restartButton.down = function (x, y, obj) { // Reset all storage data storage.money = 100; storage.inventory = {}; storage.toolInventory = {}; // Reset game variables money = 100; inventory = {}; toolInventory = {}; selectedSeed = null; selectedTool = null; shopOpen = false; fanmadeShopOpen = false; toolShopOpen = false; // Reset all plots for (var i = 0; i < plots.length; i++) { var plot = plots[i]; plot.cropType = null; plot.plantTime = 0; plot.growthStage = 0; if (plot.cropAsset) { plot.removeChild(plot.cropAsset); plot.cropAsset = null; } // Reset plot graphics tint plot.children[0].tint = 0xFFFFFF; } // Close shop if open if (shopOpen) { shopOpen = false; shopContainer.visible = false; } if (fanmadeShopOpen) { fanmadeShopOpen = false; fanmadeShopContainer.visible = false; } if (toolShopOpen) { toolShopOpen = false; toolShopContainer.visible = false; } // Update displays updateMoneyDisplay(); updateInventoryDisplay(); updateToolInventoryDisplay(); }; // Initialize display updateMoneyDisplay(); updateInventoryDisplay(); updateToolInventoryDisplay(); game.update = function () { // Update all plots for (var i = 0; i < plots.length; i++) { plots[i].update(); } };
===================================================================
--- original.js
+++ change.js
@@ -272,27 +272,32 @@
}
// Tool data
function getToolData(toolType) {
var toolData = {
+ 'waterCan': {
+ name: 'Watering Can',
+ price: 100,
+ description: 'Manually water individual crops'
+ },
'sprinkler': {
name: 'Sprinkler',
price: 200,
description: 'Waters nearby crops faster'
},
- 'waterCan': {
- name: 'Water Can',
- price: 100,
- description: 'Manually water individual crops'
+ 'goodSprinkler': {
+ name: 'Good Sprinkler',
+ price: 300,
+ description: 'Waters crops more efficiently'
},
+ 'greatSprinkler': {
+ name: 'Great Sprinkler',
+ price: 400,
+ description: 'Waters crops very efficiently'
+ },
'megaSprinkler': {
name: 'Mega Sprinkler',
price: 500,
description: 'Waters all crops instantly'
- },
- 'fertilizer': {
- name: 'Fertilizer',
- price: 150,
- description: 'Makes crops grow faster'
}
};
return toolData[toolType];
}
@@ -465,12 +470,13 @@
closeToolShopText.x = 1024;
closeToolShopText.y = 1700;
toolShopContainer.addChild(closeToolShopText);
// Tool shop items
-var sprinklerShopItem = toolShopContainer.addChild(new ToolShopItem('sprinkler', 1200));
-var waterCanShopItem = toolShopContainer.addChild(new ToolShopItem('waterCan', 1300));
-var megaSprinklerShopItem = toolShopContainer.addChild(new ToolShopItem('megaSprinkler', 1400));
-var fertilizerShopItem = toolShopContainer.addChild(new ToolShopItem('fertilizer', 1500));
+var waterCanShopItem = toolShopContainer.addChild(new ToolShopItem('waterCan', 1200));
+var sprinklerShopItem = toolShopContainer.addChild(new ToolShopItem('sprinkler', 1300));
+var goodSprinklerShopItem = toolShopContainer.addChild(new ToolShopItem('goodSprinkler', 1400));
+var greatSprinklerShopItem = toolShopContainer.addChild(new ToolShopItem('greatSprinkler', 1500));
+var megaSprinklerShopItem = toolShopContainer.addChild(new ToolShopItem('megaSprinkler', 1600));
toolShopContainer.visible = false;
game.addChild(toolShopContainer);
shopContainer.visible = false;
game.addChild(shopContainer);