User prompt
Remove the weather button
User prompt
Add the close button to the upgrade panel
User prompt
Add it to the market panel
User prompt
The menu can't be closed
User prompt
I can't close the menu pls add the close button to all menus
User prompt
Move the close button to the bottom left
User prompt
There is no close button in the upgrades menu
User prompt
Add the clos button to the upgrades menu
User prompt
Can't close the upgrades and market menu
User prompt
When the menu is open and the same button that is used to open the menu when clicked will close the menu and remove the weather button
User prompt
Make a close button for every menu
User prompt
Make the seasons effect the crops
User prompt
Add sunny, winter, rainy, thunderstorm, spring
User prompt
The money counter is gone
User prompt
The text is overlaping when restarted
User prompt
Restart button with upgrades like oven blender and fishing rod ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Give the player $15
User prompt
Give the player 10 dollars to start the game ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Add upgrades to the market and a animal pen
User prompt
Make the market
User prompt
It will take more time like 35 seconds to be grown fully
User prompt
Move the seed water and harvest buttons to the bottom right
Code edit (1 edits merged)
Please save this source code
User prompt
Harvest Tycoon: Farm & Grow
Initial prompt
Farming simulator
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { money: 50, cropsSold: 0, fieldsUnlocked: 9 }); /**** * Classes ****/ var CropButton = Container.expand(function (cropType) { var self = Container.call(this); self.cropType = cropType; var cropInfo = CropType.getInfo(cropType); var button = self.attachAsset(cropInfo.shape, { anchorX: 0.5, anchorY: 0.5, scaleX: 0.6, scaleY: 0.6 }); var priceTag = new Text2("$" + cropInfo.seedCost, { size: 25, fill: 0xFFFFFF }); priceTag.anchor.set(0.5, 0); priceTag.y = 40; self.addChild(priceTag); self.down = function (x, y, obj) { tween(self, { alpha: 0.7 }, { duration: 100 }); }; self.up = function (x, y, obj) { tween(self, { alpha: 1 }, { duration: 100 }); // Select crop type selectedCropType = self.cropType; selectedTool = 'seed'; updateToolButtons(); // Close selection cropSelectionPanel.visible = false; }; return self; }); var Market = Container.expand(function () { var self = Container.call(this); // Panel visibility state self.visible = false; // Create panel background var marketPanel = LK.getAsset('soil', { width: 1500, height: 1800, anchorX: 0.5, anchorY: 0.5 }); marketPanel.alpha = 0.9; self.addChild(marketPanel); // Title var title = new Text2("Market", { size: 100, fill: 0xFFFFFF }); title.anchor.set(0.5, 0); title.y = -800; self.addChild(title); // Close button var closeButton = new Text2("X", { size: 80, fill: 0xFF0000 }); closeButton.anchor.set(0.5); closeButton.x = 700; closeButton.y = -800; self.addChild(closeButton); // Container for crop listings var listingsContainer = new Container(); listingsContainer.y = -600; self.addChild(listingsContainer); self.listingsContainer = listingsContainer; // Stats display var statsText = new Text2("Total crops sold: 0", { size: 50, fill: 0xFFFFFF }); statsText.anchor.set(0.5, 0); statsText.y = 700; self.addChild(statsText); self.statsText = statsText; // Handle close button closeButton.down = function (x, y, obj) { tween(closeButton, { alpha: 0.7 }, { duration: 100 }); }; closeButton.up = function (x, y, obj) { tween(closeButton, { alpha: 1 }, { duration: 100 }); self.hide(); }; // Show market with updated listings self.show = function () { self.visible = true; self.updateListings(); self.statsText.setText("Total crops sold: " + storage.cropsSold); }; // Hide market self.hide = function () { self.visible = false; }; // Update crop listings based on ready crops self.updateListings = function () { // Clear current listings while (listingsContainer.children.length > 0) { listingsContainer.children[0].destroy(); } // Initialize listing counts var listings = {}; var yPos = 0; var spacing = 200; // Count ready crops by type plots.forEach(function (plot) { if (plot.state === PlotState.READY) { var type = plot.cropType; if (!listings[type]) { listings[type] = { count: 1, info: CropType.getInfo(type) }; } else { listings[type].count++; } } }); // Create listing for each crop type var listingCount = 0; for (var cropType in listings) { var listing = self.createListing(cropType, listings[cropType]); listing.y = yPos; listingsContainer.addChild(listing); yPos += spacing; listingCount++; } // Show message if no crops ready if (listingCount === 0) { var noItems = new Text2("No crops ready to sell!", { size: 50, fill: 0xFFFFFF }); noItems.anchor.set(0.5, 0); listingsContainer.addChild(noItems); } }; // Create individual listing self.createListing = function (cropType, data) { var container = new Container(); var info = data.info; var count = data.count; var totalValue = count * info.sellPrice; // Crop icon var icon = LK.getAsset(info.shape, { anchorX: 0.5, anchorY: 0.5, scaleX: 0.8, scaleY: 0.8 }); icon.x = -550; container.addChild(icon); // Crop info var nameText = new Text2(info.name + " x" + count, { size: 50, fill: 0xFFFFFF }); nameText.anchor.set(0, 0.5); nameText.x = -400; container.addChild(nameText); // Value var valueText = new Text2("$" + totalValue, { size: 50, fill: 0xFFFF00 }); valueText.anchor.set(0, 0.5); valueText.x = 100; container.addChild(valueText); // Sell button var sellButton = LK.getAsset('marketButton', { width: 200, height: 100, anchorX: 0.5, anchorY: 0.5 }); sellButton.x = 500; container.addChild(sellButton); var sellText = new Text2("Sell", { size: 40, fill: 0xFFFFFF }); sellText.anchor.set(0.5); sellText.x = 500; container.addChild(sellText); // Sell button interaction sellButton.down = function (x, y, obj) { tween(sellButton, { alpha: 0.7 }, { duration: 100 }); }; sellButton.up = function (x, y, obj) { tween(sellButton, { alpha: 1 }, { duration: 100 }); // Sell this crop type var soldCount = 0; plots.forEach(function (plot) { if (plot.state === PlotState.READY && plot.cropType == cropType) { plot.reset(); soldCount++; } }); // Award money and update stats if (soldCount > 0) { money += soldCount * info.sellPrice; storage.cropsSold += soldCount; storage.money = money; updateMoneyDisplay(); // Show feedback var sellMessage = new Text2("Sold " + soldCount + " " + info.name + " for $" + soldCount * info.sellPrice + "!", { size: 60, fill: 0xFFFF00 }); sellMessage.anchor.set(0.5); sellMessage.x = 0; sellMessage.y = 300; container.addChild(sellMessage); // Animate and remove tween(sellMessage, { alpha: 0, y: 200 }, { duration: 2000, onFinish: function onFinish() { sellMessage.destroy(); self.updateListings(); self.statsText.setText("Total crops sold: " + storage.cropsSold); } }); LK.getSound('sell').play(); } }; return container; }; return self; }); var MarketButton = Container.expand(function () { var self = Container.call(this); var button = self.attachAsset('marketButton', { anchorX: 0.5, anchorY: 0.5 }); var label = new Text2("Market", { size: 50, fill: 0xFFFFFF }); label.anchor.set(0.5); self.addChild(label); self.down = function (x, y, obj) { tween(self, { alpha: 0.7 }, { duration: 100 }); }; self.up = function (x, y, obj) { tween(self, { alpha: 1 }, { duration: 100 }); // Open market panel marketPanel.show(); }; return self; }); var Plot = Container.expand(function () { var self = Container.call(this); self.state = PlotState.EMPTY; self.cropType = CropType.NONE; self.growthProgress = 0; self.growthTotal = 0; self.needsWater = false; self.isWet = false; // Create soil var soil = self.attachAsset('soil', { anchorX: 0.5, anchorY: 0.5 }); self.soil = soil; // Growth indicator (invisible initially) var seedling = self.attachAsset('seedling', { anchorX: 0.5, anchorY: 1.0, y: 50, visible: false }); self.seedling = seedling; self.plant = function (cropType) { if (self.state !== PlotState.EMPTY || money < CropType.getInfo(cropType).seedCost) { return false; } money -= CropType.getInfo(cropType).seedCost; updateMoneyDisplay(); self.cropType = cropType; self.state = PlotState.SEEDED; self.growthProgress = 0; self.growthTotal = CropType.getInfo(cropType).growthTime * 60; // Convert to frames self.needsWater = true; self.seedling.visible = true; self.seedling.height = 30; // Small at first LK.getSound('plant').play(); return true; }; self.water = function () { if (self.state !== PlotState.SEEDED && self.state !== PlotState.GROWING) { return false; } self.isWet = true; self.needsWater = false; self.soil.texture = LK.getAsset('wetSoil', {}).texture; // Reset drying timeout self.dryTimer = LK.setTimeout(function () { self.isWet = false; self.needsWater = true; self.soil.texture = LK.getAsset('soil', {}).texture; }, 5000); // Soil stays wet for 5 seconds LK.getSound('water').play(); return true; }; self.harvest = function () { if (self.state !== PlotState.READY) { return false; } money += CropType.getInfo(self.cropType).sellPrice; storage.cropsSold++; updateMoneyDisplay(); self.reset(); LK.getSound('harvest').play(); return true; }; self.reset = function () { self.state = PlotState.EMPTY; self.cropType = CropType.NONE; self.growthProgress = 0; self.growthTotal = 0; self.needsWater = false; self.isWet = false; self.soil.texture = LK.getAsset('soil', {}).texture; self.seedling.visible = false; if (self.dryTimer) { LK.clearTimeout(self.dryTimer); } }; self.update = function () { // Only grow if it's watered if ((self.state === PlotState.SEEDED || self.state === PlotState.GROWING) && self.isWet) { self.growthProgress++; // Update crop appearance based on growth progress var growthPercentage = self.growthProgress / self.growthTotal; if (growthPercentage < 0.3) { self.state = PlotState.SEEDED; self.seedling.height = 30 + growthPercentage * 100; } else if (growthPercentage < 1) { self.state = PlotState.GROWING; // If we just entered growing state, change the shape if (self.seedling.texture !== LK.getAsset(CropType.getInfo(self.cropType).shape, {}).texture) { self.seedling.texture = LK.getAsset(CropType.getInfo(self.cropType).shape, {}).texture; self.seedling.width = LK.getAsset(CropType.getInfo(self.cropType).shape, {}).width; self.seedling.height = LK.getAsset(CropType.getInfo(self.cropType).shape, {}).height * growthPercentage; } else { self.seedling.height = LK.getAsset(CropType.getInfo(self.cropType).shape, {}).height * growthPercentage; } } else { // Fully grown self.state = PlotState.READY; self.seedling.height = LK.getAsset(CropType.getInfo(self.cropType).shape, {}).height; // Make it bounce a little to show it's ready tween(self.seedling, { y: 45 }, { duration: 500, easing: tween.easeInOut, onFinish: function onFinish() { tween(self.seedling, { y: 50 }, { duration: 500, easing: tween.easeInOut }); } }); } } }; // Handle interaction self.down = function (x, y, obj) { // Selection effect tween(self, { alpha: 0.7 }, { duration: 100 }); }; self.up = function (x, y, obj) { tween(self, { alpha: 1 }, { duration: 100 }); if (selectedTool === 'seed') { if (selectedCropType !== CropType.NONE) { self.plant(selectedCropType); } } else if (selectedTool === 'water') { self.water(); } else if (selectedTool === 'harvest') { self.harvest(); } }; return self; }); var ToolButton = Container.expand(function (toolType, shape) { var self = Container.call(this); self.toolType = toolType; var button = self.attachAsset(shape, { anchorX: 0.5, anchorY: 0.5 }); var label = new Text2(toolType.charAt(0).toUpperCase() + toolType.slice(1), { size: 30, fill: 0xFFFFFF }); label.anchor.set(0.5); self.addChild(label); self.setSelected = function (isSelected) { button.alpha = isSelected ? 1.0 : 0.7; if (isSelected) { tween(self, { scaleX: 1.1, scaleY: 1.1 }, { duration: 200 }); } else { tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200 }); } }; self.down = function (x, y, obj) { tween(self, { alpha: 0.7 }, { duration: 100 }); }; self.up = function (x, y, obj) { tween(self, { alpha: 1 }, { duration: 100 }); // Update selected tool if (self.toolType === 'seed') { openCropSelection(); } else { selectedTool = self.toolType; selectedCropType = CropType.NONE; updateToolButtons(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Game variables var PlotState = { EMPTY: 0, SEEDED: 1, GROWING: 2, READY: 3 }; var CropType = { NONE: 0, CARROT: 1, CORN: 2, TOMATO: 3, getInfo: function getInfo(type) { switch (type) { case CropType.CARROT: return { name: "Carrot", growthTime: 35, // in seconds for demo seedCost: 5, sellPrice: 10, shape: 'carrot' }; case CropType.CORN: return { name: "Corn", growthTime: 45, // in seconds for demo seedCost: 10, sellPrice: 25, shape: 'corn' }; case CropType.TOMATO: return { name: "Tomato", growthTime: 55, // in seconds for demo seedCost: 15, sellPrice: 40, shape: 'tomato' }; default: return { name: "None", growthTime: 0, seedCost: 0, sellPrice: 0, shape: null }; } } }; var plots = []; var toolButtons = {}; var cropSelectionPanel; var marketPanel; var moneyDisplay; var money = storage.money; var selectedTool = 'seed'; var selectedCropType = CropType.NONE; // Initialize the farm layout function initializeFarm() { var plotSize = 220; // Size of each plot including margin var gridSize = 3; // 3x3 grid var startX = (2048 - plotSize * gridSize) / 2 + plotSize / 2; var startY = 600; // Start plots below the top UI area // Create plots in a grid for (var row = 0; row < gridSize; row++) { for (var col = 0; col < gridSize; col++) { var plot = new Plot(); plot.x = startX + col * plotSize; plot.y = startY + row * plotSize; // Check if unlocked if (row * gridSize + col < storage.fieldsUnlocked) { game.addChild(plot); plots.push(plot); } } } } // Create UI function createUI() { // Money display moneyDisplay = new Text2("$" + money, { size: 70, fill: 0xFFFF00 }); moneyDisplay.anchor.set(0, 0); moneyDisplay.x = 150; moneyDisplay.y = 50; LK.gui.addChild(moneyDisplay); // Title var titleText = new Text2("Harvest Tycoon", { size: 100, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0); titleText.x = 2048 / 2; titleText.y = 50; LK.gui.addChild(titleText); // Create tool buttons var buttonSize = 120; var buttonSpacing = buttonSize * 1.2; var buttonStartX = 2048 - buttonSize - 50; // Right side of screen with some margin var buttonY = 2732 - buttonSize - 50; // Bottom of screen with some margin // Harvest button (rightmost) toolButtons.harvest = new ToolButton('harvest', 'harvestButton'); toolButtons.harvest.x = buttonStartX; toolButtons.harvest.y = buttonY; game.addChild(toolButtons.harvest); // Water button (middle) toolButtons.water = new ToolButton('water', 'waterButton'); toolButtons.water.x = buttonStartX - buttonSpacing; toolButtons.water.y = buttonY; game.addChild(toolButtons.water); // Seed button (leftmost of the three) toolButtons.seed = new ToolButton('seed', 'seedButton'); toolButtons.seed.x = buttonStartX - buttonSpacing * 2; toolButtons.seed.y = buttonY; game.addChild(toolButtons.seed); // Market button (to sell all ready crops) var marketButton = new MarketButton(); marketButton.x = 2048 - 200; marketButton.y = 200; game.addChild(marketButton); // Create crop selection panel (initially hidden) cropSelectionPanel = new Container(); cropSelectionPanel.visible = false; game.addChild(cropSelectionPanel); // Create market panel (initially hidden) marketPanel = new Market(); marketPanel.x = 2048 / 2; marketPanel.y = 2732 / 2; game.addChild(marketPanel); // Panel background var panelBg = LK.getAsset('soil', { width: 500, height: 200, anchorX: 0.5, anchorY: 0.5 }); panelBg.alpha = 0.8; cropSelectionPanel.addChild(panelBg); // Add crop buttons var cropButtonX = -150; var cropButtonY = 0; var cropButtonSpacing = 150; var carrotButton = new CropButton(CropType.CARROT); carrotButton.x = cropButtonX; carrotButton.y = cropButtonY; cropSelectionPanel.addChild(carrotButton); var cornButton = new CropButton(CropType.CORN); cornButton.x = cropButtonX + cropButtonSpacing; cornButton.y = cropButtonY; cropSelectionPanel.addChild(cornButton); var tomatoButton = new CropButton(CropType.TOMATO); tomatoButton.x = cropButtonX + cropButtonSpacing * 2; tomatoButton.y = cropButtonY; cropSelectionPanel.addChild(tomatoButton); // Position the panel cropSelectionPanel.x = 2048 / 2; cropSelectionPanel.y = 400; // Set initial tool button states updateToolButtons(); } // Update the money display function updateMoneyDisplay() { moneyDisplay.setText("$" + money); storage.money = money; } // Open crop selection panel function openCropSelection() { cropSelectionPanel.visible = true; selectedTool = 'seed'; updateToolButtons(); } // Update tool button highlighting function updateToolButtons() { for (var tool in toolButtons) { toolButtons[tool].setSelected(tool === selectedTool); } } // Initialize game initializeFarm(); createUI(); // Play background music LK.playMusic('farmMusic'); // Game update loop game.update = function () { // Update all plots for (var i = 0; i < plots.length; i++) { plots[i].update(); } };
===================================================================
--- original.js
+++ change.js
@@ -49,8 +49,224 @@
cropSelectionPanel.visible = false;
};
return self;
});
+var Market = Container.expand(function () {
+ var self = Container.call(this);
+ // Panel visibility state
+ self.visible = false;
+ // Create panel background
+ var marketPanel = LK.getAsset('soil', {
+ width: 1500,
+ height: 1800,
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ marketPanel.alpha = 0.9;
+ self.addChild(marketPanel);
+ // Title
+ var title = new Text2("Market", {
+ size: 100,
+ fill: 0xFFFFFF
+ });
+ title.anchor.set(0.5, 0);
+ title.y = -800;
+ self.addChild(title);
+ // Close button
+ var closeButton = new Text2("X", {
+ size: 80,
+ fill: 0xFF0000
+ });
+ closeButton.anchor.set(0.5);
+ closeButton.x = 700;
+ closeButton.y = -800;
+ self.addChild(closeButton);
+ // Container for crop listings
+ var listingsContainer = new Container();
+ listingsContainer.y = -600;
+ self.addChild(listingsContainer);
+ self.listingsContainer = listingsContainer;
+ // Stats display
+ var statsText = new Text2("Total crops sold: 0", {
+ size: 50,
+ fill: 0xFFFFFF
+ });
+ statsText.anchor.set(0.5, 0);
+ statsText.y = 700;
+ self.addChild(statsText);
+ self.statsText = statsText;
+ // Handle close button
+ closeButton.down = function (x, y, obj) {
+ tween(closeButton, {
+ alpha: 0.7
+ }, {
+ duration: 100
+ });
+ };
+ closeButton.up = function (x, y, obj) {
+ tween(closeButton, {
+ alpha: 1
+ }, {
+ duration: 100
+ });
+ self.hide();
+ };
+ // Show market with updated listings
+ self.show = function () {
+ self.visible = true;
+ self.updateListings();
+ self.statsText.setText("Total crops sold: " + storage.cropsSold);
+ };
+ // Hide market
+ self.hide = function () {
+ self.visible = false;
+ };
+ // Update crop listings based on ready crops
+ self.updateListings = function () {
+ // Clear current listings
+ while (listingsContainer.children.length > 0) {
+ listingsContainer.children[0].destroy();
+ }
+ // Initialize listing counts
+ var listings = {};
+ var yPos = 0;
+ var spacing = 200;
+ // Count ready crops by type
+ plots.forEach(function (plot) {
+ if (plot.state === PlotState.READY) {
+ var type = plot.cropType;
+ if (!listings[type]) {
+ listings[type] = {
+ count: 1,
+ info: CropType.getInfo(type)
+ };
+ } else {
+ listings[type].count++;
+ }
+ }
+ });
+ // Create listing for each crop type
+ var listingCount = 0;
+ for (var cropType in listings) {
+ var listing = self.createListing(cropType, listings[cropType]);
+ listing.y = yPos;
+ listingsContainer.addChild(listing);
+ yPos += spacing;
+ listingCount++;
+ }
+ // Show message if no crops ready
+ if (listingCount === 0) {
+ var noItems = new Text2("No crops ready to sell!", {
+ size: 50,
+ fill: 0xFFFFFF
+ });
+ noItems.anchor.set(0.5, 0);
+ listingsContainer.addChild(noItems);
+ }
+ };
+ // Create individual listing
+ self.createListing = function (cropType, data) {
+ var container = new Container();
+ var info = data.info;
+ var count = data.count;
+ var totalValue = count * info.sellPrice;
+ // Crop icon
+ var icon = LK.getAsset(info.shape, {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 0.8,
+ scaleY: 0.8
+ });
+ icon.x = -550;
+ container.addChild(icon);
+ // Crop info
+ var nameText = new Text2(info.name + " x" + count, {
+ size: 50,
+ fill: 0xFFFFFF
+ });
+ nameText.anchor.set(0, 0.5);
+ nameText.x = -400;
+ container.addChild(nameText);
+ // Value
+ var valueText = new Text2("$" + totalValue, {
+ size: 50,
+ fill: 0xFFFF00
+ });
+ valueText.anchor.set(0, 0.5);
+ valueText.x = 100;
+ container.addChild(valueText);
+ // Sell button
+ var sellButton = LK.getAsset('marketButton', {
+ width: 200,
+ height: 100,
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ sellButton.x = 500;
+ container.addChild(sellButton);
+ var sellText = new Text2("Sell", {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ sellText.anchor.set(0.5);
+ sellText.x = 500;
+ container.addChild(sellText);
+ // Sell button interaction
+ sellButton.down = function (x, y, obj) {
+ tween(sellButton, {
+ alpha: 0.7
+ }, {
+ duration: 100
+ });
+ };
+ sellButton.up = function (x, y, obj) {
+ tween(sellButton, {
+ alpha: 1
+ }, {
+ duration: 100
+ });
+ // Sell this crop type
+ var soldCount = 0;
+ plots.forEach(function (plot) {
+ if (plot.state === PlotState.READY && plot.cropType == cropType) {
+ plot.reset();
+ soldCount++;
+ }
+ });
+ // Award money and update stats
+ if (soldCount > 0) {
+ money += soldCount * info.sellPrice;
+ storage.cropsSold += soldCount;
+ storage.money = money;
+ updateMoneyDisplay();
+ // Show feedback
+ var sellMessage = new Text2("Sold " + soldCount + " " + info.name + " for $" + soldCount * info.sellPrice + "!", {
+ size: 60,
+ fill: 0xFFFF00
+ });
+ sellMessage.anchor.set(0.5);
+ sellMessage.x = 0;
+ sellMessage.y = 300;
+ container.addChild(sellMessage);
+ // Animate and remove
+ tween(sellMessage, {
+ alpha: 0,
+ y: 200
+ }, {
+ duration: 2000,
+ onFinish: function onFinish() {
+ sellMessage.destroy();
+ self.updateListings();
+ self.statsText.setText("Total crops sold: " + storage.cropsSold);
+ }
+ });
+ LK.getSound('sell').play();
+ }
+ };
+ return container;
+ };
+ return self;
+});
var MarketButton = Container.expand(function () {
var self = Container.call(this);
var button = self.attachAsset('marketButton', {
anchorX: 0.5,
@@ -74,43 +290,10 @@
alpha: 1
}, {
duration: 100
});
- // Sell all ready crops
- var cropsSold = 0;
- var moneyEarned = 0;
- plots.forEach(function (plot) {
- if (plot.state === PlotState.READY) {
- moneyEarned += CropType.getInfo(plot.cropType).sellPrice;
- cropsSold++;
- plot.reset();
- }
- });
- if (cropsSold > 0) {
- money += moneyEarned;
- storage.cropsSold += cropsSold;
- updateMoneyDisplay();
- // Show feedback
- var sellMessage = new Text2("Sold " + cropsSold + " crops for $" + moneyEarned + "!", {
- size: 60,
- fill: 0xFFFF00
- });
- sellMessage.anchor.set(0.5);
- sellMessage.x = 2048 / 2;
- sellMessage.y = 2732 / 2;
- game.addChild(sellMessage);
- // Animate and remove
- tween(sellMessage, {
- alpha: 0,
- y: sellMessage.y - 100
- }, {
- duration: 2000,
- onFinish: function onFinish() {
- sellMessage.destroy();
- }
- });
- LK.getSound('sell').play();
- }
+ // Open market panel
+ marketPanel.show();
};
return self;
});
var Plot = Container.expand(function () {
@@ -379,8 +562,9 @@
};
var plots = [];
var toolButtons = {};
var cropSelectionPanel;
+var marketPanel;
var moneyDisplay;
var money = storage.money;
var selectedTool = 'seed';
var selectedCropType = CropType.NONE;
@@ -452,8 +636,13 @@
// Create crop selection panel (initially hidden)
cropSelectionPanel = new Container();
cropSelectionPanel.visible = false;
game.addChild(cropSelectionPanel);
+ // Create market panel (initially hidden)
+ marketPanel = new Market();
+ marketPanel.x = 2048 / 2;
+ marketPanel.y = 2732 / 2;
+ game.addChild(marketPanel);
// Panel background
var panelBg = LK.getAsset('soil', {
width: 500,
height: 200,
Carrot 2d pixilated topdown. In-Game asset. 2d. High contrast. No shadows
Button blank lime 2d pixilated topdown. In-Game asset. 2d. High contrast. No shadows
Square yellow button 2d pixilated topdown. In-Game asset. 2d. High contrast. No shadows
Soil 2d pixilated topdown. In-Game asset. 2d. High contrast. No shadows
Corn 2d pixilated topdown. In-Game asset. 2d. High contrast. No shadows
Tomato 2d pixilated topdown. In-Game asset. 2d. High contrast. No shadows