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; }); /**** * 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 selectedSeed = null; var shopOpen = false; // Crop data function getCropData(cropType) { var cropData = { 'carrot': { name: 'Carrot', seedPrice: 10, sellPrice: 25, sproutTime: 180, // 3 seconds matureTime: 300 // 5 seconds }, 'strawberry': { name: 'Strawberry', seedPrice: 20, sellPrice: 60, sproutTime: 300, // 5 seconds matureTime: 480 // 8 seconds }, 'blueberry': { name: 'Blueberry', seedPrice: 35, sellPrice: 120, sproutTime: 480, // 8 seconds matureTime: 720 // 12 seconds }, 'orange': { name: 'Orange', seedPrice: 25, sellPrice: 80, sproutTime: 360, // 6 seconds matureTime: 600 // 10 seconds }, 'tulip': { name: 'Tulip', seedPrice: 15, sellPrice: 45, sproutTime: 240, // 4 seconds matureTime: 420 // 7 seconds }, 'tomato': { name: 'Tomato', seedPrice: 30, sellPrice: 90, sproutTime: 420, // 7 seconds matureTime: 660 // 11 seconds } }; return cropData[cropType]; } // 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); // 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); // 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 orangeShopItem = shopContainer.addChild(new ShopItem('orange', 1500)); var tulipShopItem = shopContainer.addChild(new ShopItem('tulip', 1600)); var tomatoShopItem = shopContainer.addChild(new ShopItem('tomato', 1700)); shopContainer.visible = false; game.addChild(shopContainer); // Garden plots var plots = []; var plotRows = 4; var plotCols = 5; var plotSpacing = 200; var startX = 1024 - (plotCols - 1) * plotSpacing / 2; var startY = 400; 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; } // Shop button handler shopButton.down = function (x, y, obj) { if (shopOpen) { shopOpen = false; shopContainer.visible = false; } else { shopOpen = true; shopContainer.visible = true; } }; // Game click handler for closing shop game.down = function (x, y, obj) { if (shopOpen && obj === game) { shopOpen = false; shopContainer.visible = false; } }; // Initialize display updateMoneyDisplay(); updateInventoryDisplay(); game.update = function () { // Update all plots for (var i = 0; i < plots.length; i++) { plots[i].update(); } };
===================================================================
--- original.js
+++ change.js
@@ -168,8 +168,32 @@
sellPrice: 120,
sproutTime: 480,
// 8 seconds
matureTime: 720 // 12 seconds
+ },
+ 'orange': {
+ name: 'Orange',
+ seedPrice: 25,
+ sellPrice: 80,
+ sproutTime: 360,
+ // 6 seconds
+ matureTime: 600 // 10 seconds
+ },
+ 'tulip': {
+ name: 'Tulip',
+ seedPrice: 15,
+ sellPrice: 45,
+ sproutTime: 240,
+ // 4 seconds
+ matureTime: 420 // 7 seconds
+ },
+ 'tomato': {
+ name: 'Tomato',
+ seedPrice: 30,
+ sellPrice: 90,
+ sproutTime: 420,
+ // 7 seconds
+ matureTime: 660 // 11 seconds
}
};
return cropData[cropType];
}
@@ -236,10 +260,13 @@
closeShopText.y = 1700;
shopContainer.addChild(closeShopText);
// Shop items
var carrotShopItem = shopContainer.addChild(new ShopItem('carrot', 1200));
-var strawberryShopItem = shopContainer.addChild(new ShopItem('strawberry', 1350));
-var blueberryShopItem = shopContainer.addChild(new ShopItem('blueberry', 1500));
+var strawberryShopItem = shopContainer.addChild(new ShopItem('strawberry', 1300));
+var blueberryShopItem = shopContainer.addChild(new ShopItem('blueberry', 1400));
+var orangeShopItem = shopContainer.addChild(new ShopItem('orange', 1500));
+var tulipShopItem = shopContainer.addChild(new ShopItem('tulip', 1600));
+var tomatoShopItem = shopContainer.addChild(new ShopItem('tomato', 1700));
shopContainer.visible = false;
game.addChild(shopContainer);
// Garden plots
var plots = [];