User prompt
Tap items to scan them yazısı shoptayken görünmesin
User prompt
Marketdeyken diğer hiçbir butona basamayalım, ve ürünleri ödeyemeyelim
User prompt
Kasanın altına open/close butonu ekle. Open iken basınca close olsun(yani kırmızı) close iken basınca open olsun(yani yeşil) close iken müşteri doğamasın. Open iken müşteri doğabilsin
User prompt
Hayır, shop ekranında şunlar olsun: 1- Shop'u böl. Yani shopta önce ürün(yiyecek) satın alma yeri(artık gğn bitimi ekranından sonra ürünler otomatik eklenmeyecek) ondan sonra malzeme alma yeri(raf, buz dolabı gibi) birde dükkan özelleştirmesi kısmı olsun. Bu 3 butona basarak ürün kategorileri arasına dolaşabilelim.
User prompt
Bir tane kare buton ekle. Bu ekranın sol altında olsun. Buna basınca beyaz bir ekran açılsın ve burada market için internetten satın alabileceğimiz ürünler olsun.
User prompt
Yiyecek satırlarının arasında boşluk aç
User prompt
Hayır eski haline al. Onu demedim yiyecek satırlarının arasına boşluk aç. Rafları eski haline getir
User prompt
Ürün satırlarının arasına biraz daha boşluk aç. Yani en üst satırdaki ürünleri hiç elleme. Diğerlerinin yerini değiştirerek 3 satırın da arasında eşit boşluk kalıcak şekilde ayır
User prompt
Para yazısının rengini koyu yeşil yapabilir misin
Code edit (1 edits merged)
Please save this source code
User prompt
Continue butonunu bir image olarak ekle. istediğim zaman değiştirebilmek istiyorum
User prompt
Continue butonunu ekranın aşağısına al, rengini beyaz yap, continue yazısını büyüt, rengini açik mavi yap, butonun üzerine yerleştir
User prompt
Sağ alta bir buton ekle. Ona basınca direkt gün sonu ekranı gelsin
User prompt
Müşteriler ürün alırken de bir ses çalsın
User prompt
Hayır titreme animsayonunu yine 100ms yap. Birde müşterinin titremeye başlaması için 5 değil 10 saniye beklesin
User prompt
Müşteri titreme süresini 5ten 10a çıkart. Birde sinirlenme süresini 5 saniye yap
User prompt
Şimdi onu 40 yapabilir misin
User prompt
Ya da bu ekranı ce bu ekranla ilgili tüm kodları sil. Vazgeçtim
User prompt
Ama resume ye basınca kaldıkları yerden devam etsinler
User prompt
Olmadı. Müşteriler pause a basana kadat hareket etmesin
User prompt
Buna basınca tüm müşteriler dursun. Müşteriler ile ilgili kodlar da dursun
User prompt
Şimdi ekranın sağ altına bir tane buton ekle. Bu butona basınca ekran kararsın ve arkadaki müşterilerin hepsi dursun(oyunu durdurmak gibi). Bu açılan ekranın sağ üstünde yuvarlak bir buton olsun. Ona basınca da oyuna kaldığımız yerden devam edelim
User prompt
Birde en son hangi günde kaldıysak o günden devam edelim. Paramız da o günün başında ne kadarsa ordan devam etsin. Yani ben oyunu yenilediğimde kaldığım günün başından devam ediyim ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Devam et butonuna basınca yeni güne geçelim. Basmadan değil
Code edit (1 edits merged)
Please save this source code
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Customer = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('customer', { anchorX: 0.5, anchorY: 1 }); self.items = []; self.currentItemIndex = 0; self.isBeingServed = false; self.patience = 100; self.maxPatience = 100; self.waitTime = 0; self.isShopping = true; self.targetShelf = null; self.itemsToCollect = Math.floor(Math.random() * 3) + 2; self.upset = false; self.angry = false; self.upsetStartTime = 0; self.paid = false; self.placeItemsOnCounter = function () { var startY = counterY + 50 - self.items.length * 70 / 2; for (var i = 0; i < self.items.length; i++) { var item = self.items[i]; // Don't add item directly, it's already part of customer // Instead, create a new product with the same properties var counterItem = new Product(item.productType); counterItem.value = item.value; counterItem.name = item.name; counterItem.productType = item.productType; counterItem.x = 900; // Move to the left from center counterItem.y = startY + i * 70; // Place items vertically game.addChild(counterItem); // Replace the item in the array with the counter version self.items[i] = counterItem; } }; self.allItemsScanned = function () { for (var i = 0; i < self.items.length; i++) { if (!self.items[i].scanned) { return false; } } return true; }; self.getTotalValue = function () { var total = 0; for (var i = 0; i < self.items.length; i++) { total += self.items[i].value; } return total; }; self.completeTransaction = function () { // Mark customer as paid self.paid = true; // If customer was upset, stop shaking animation if (self.upset) { tween.stop(self, { x: true }); self.x = self.originalX; } // Remove items from counter for (var i = 0; i < self.items.length; i++) { if (self.items[i].parent) { self.items[i].destroy(); } } // Add to money var earnings = self.getTotalValue(); money += earnings; dailyEarnings += earnings; scoreTxt.setText(money + '₺'); // Play sound LK.getSound('cashRegister').play(); // Move customer out tween(self, { x: -200 }, { duration: 1000, onFinish: function onFinish() { totalCustomersExited++; // Increment exit counter self.destroy(); } }); }; self.collectItemFromShelf = function () { if (self.items.length < self.itemsToCollect && self.targetShelf) { var takenProduct = self.targetShelf.takeProduct(); if (takenProduct) { // Store the product data directly without creating a visual product yet self.items.push({ productType: takenProduct.productType, value: takenProduct.value, name: takenProduct.name, scanned: false }); // Visual feedback tween(graphics, { scaleX: 1.2, scaleY: 1.2 }, { duration: 200, onFinish: function onFinish() { tween(graphics, { scaleX: 1, scaleY: 1 }, { duration: 200 }); } }); // Play sound when customer takes item LK.getSound('customerPurchase').play(); } } }; self.update = function () { // Track wait time for customers being served if (self.isBeingServed && !self.upset && !self.angry && !self.paid) { self.waitTime++; // Check if customer should become upset (10 seconds = 600 frames at 60fps) if (self.waitTime >= 600) { self.upset = true; self.upsetStartTime = 0; // Change color to indicate upset state (slightly darker) graphics.tint = 0x888888; // Start shaking animation self.originalX = self.x; self.shakeAnimation = function () { if (self.upset && !self.angry && !self.paid) { tween(self, { x: self.originalX + (Math.random() - 0.5) * 20 }, { duration: 100, onFinish: function onFinish() { if (self.upset && !self.angry && !self.paid) { self.shakeAnimation(); } } }); } }; self.shakeAnimation(); } } // Track upset time and transition to angry (only if not paid) if (self.upset && !self.angry && !self.paid) { self.upsetStartTime++; // Check if customer should become angry (5 seconds = 300 frames at 60fps) if (self.upsetStartTime >= 300) { self.angry = true; // Stop shaking animation tween.stop(self, { x: true }); self.x = self.originalX; // Change color to red when angry graphics.tint = 0xFF0000; // Remove items from counter when angry customer leaves for (var i = 0; i < self.items.length; i++) { if (self.items[i].parent) { self.items[i].destroy(); } } // Make angry customer leave the store tween(self, { x: -200 }, { duration: 1000, onFinish: function onFinish() { totalCustomersExited++; // Increment exit counter self.destroy(); } }); } } }; return self; }); var Product = Container.expand(function (productType) { var self = Container.call(this); // Define product types with their properties var productTypes = [{ asset: 'apple', name: 'Apple', value: 20 }, { asset: 'banana', name: 'Banana', value: 40 }, { asset: 'orange', name: 'Orange', value: 30 }, { asset: 'milk', name: 'Milk', value: 50 }, { asset: 'bread', name: 'Bread', value: 10 }, { asset: 'cheese', name: 'Cheese', value: 30 }]; // Use specified product type or randomly select one var selectedType; if (productType) { // Find the product type that matches the specified type for (var i = 0; i < productTypes.length; i++) { if (productTypes[i].asset === productType) { selectedType = productTypes[i]; break; } } } if (!selectedType) { // Fallback to random selection if no type specified or not found selectedType = productTypes[Math.floor(Math.random() * productTypes.length)]; } var graphics = self.attachAsset(selectedType.asset, { anchorX: 0.5, anchorY: 0.5 }); self.scanned = false; self.value = selectedType.value; self.name = selectedType.name; self.productType = selectedType.asset; // Visual feedback for scanned items self.scan = function () { if (!self.scanned) { self.scanned = true; graphics.alpha = 0.5; // Make transparent when scanned LK.getSound('itemScan').play(); } }; self.down = function (x, y, obj) { if (!shopOpen) { self.scan(); } }; return self; }); var Shelf = Container.expand(function () { var self = Container.call(this); var graphics = self.attachAsset('shelf', { anchorX: 0.5, anchorY: 0.5 }); self.products = []; // Create products on shelf self.createProducts = function () { var rows = 3; var cols = 3; var spacing = 80; var startX = -100; var startY = -120; // Define product types for this shelf var productTypes = [{ asset: 'apple', name: 'Apple', value: 20 }, { asset: 'banana', name: 'Banana', value: 40 }, { asset: 'orange', name: 'Orange', value: 30 }, { asset: 'milk', name: 'Milk', value: 50 }, { asset: 'bread', name: 'Bread', value: 10 }, { asset: 'cheese', name: 'Cheese', value: 30 }]; // Each shelf will have products organized by type in rows var shelfProductTypes = []; var numTypes = Math.min(rows, productTypes.length); // One type per row, max 3 types for (var t = 0; t < numTypes; t++) { var randomType = productTypes[Math.floor(Math.random() * productTypes.length)]; // Make sure we don't duplicate types on same shelf var alreadyExists = false; for (var e = 0; e < shelfProductTypes.length; e++) { if (shelfProductTypes[e].asset === randomType.asset) { alreadyExists = true; break; } } if (!alreadyExists) { shelfProductTypes.push(randomType); } else { t--; // Try again with different type } } for (var row = 0; row < rows; row++) { for (var col = 0; col < cols; col++) { // Each row has the same product type var selectedType = shelfProductTypes[row % shelfProductTypes.length]; var product = self.attachAsset(selectedType.asset, { anchorX: 0.5, anchorY: 0.5 }); product.x = startX + col * spacing; product.y = startY + row * (spacing + 20); // Add extra 20px spacing between rows product.available = true; product.productType = selectedType.asset; product.name = selectedType.name; product.value = selectedType.value; self.products.push(product); } } }; self.createProducts(); self.takeProduct = function () { for (var i = 0; i < self.products.length; i++) { if (self.products[i].available) { var product = self.products[i]; product.available = false; product.visible = false; return { value: product.value, name: product.name, productType: product.productType }; } } return null; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xfffca1 }); /**** * Game Code ****/ var customers = []; var customerQueue = []; var currentCustomer = null; var spawnTimer = 0; var spawnDelay = 540; // 9 seconds at 60fps (360*1.5) var counterY = 2300; // Bottom of screen var money = storage.money || 0; // Player's money - load from storage var totalCustomersSpawned = 0; // Track total customers spawned var totalCustomersExited = 0; // Track total customers who left the store var currentDay = storage.currentDay || 1; // Current day number - load from storage var dailyEarnings = 0; // Money earned today var gameOverPaused = false; // Track if game is paused for day summary var storeOpen = true; // Track if store is open or closed var shopOpen = false; // Track if shop overlay is open // No changes needed - the code already ensures only the customer being served gets angry var shelves = []; // Create shelves at fixed positions var shelfPositions = [{ x: 400, y: 1000 }, { x: 1600, y: 1000 }, { x: 400, y: 1600 }, { x: 1600, y: 1600 }]; for (var i = 0; i < shelfPositions.length; i++) { var shelf = new Shelf(); shelf.x = shelfPositions[i].x; shelf.y = shelfPositions[i].y; shelves.push(shelf); game.addChild(shelf); } // Create cash register at bottom center var cashRegister = game.addChild(LK.getAsset('cashRegister', { anchorX: 0.5, anchorY: 0.5 })); cashRegister.x = 1024; // Center of screen cashRegister.y = counterY; // Bottom position // Create open/close button below cash register var openCloseBtn = game.addChild(LK.getAsset('openCloseButton', { anchorX: 0.5, anchorY: 0.5 })); openCloseBtn.x = 1024; openCloseBtn.y = counterY + 200; // Position below cash register var openCloseText = new Text2('OPEN', { size: 30, fill: 0xffffff }); openCloseText.anchor.set(0.5, 0.5); openCloseText.x = 1024; openCloseText.y = counterY + 200; game.addChild(openCloseText); // Handle open/close button click openCloseBtn.down = function () { if (!shopOpen) { storeOpen = !storeOpen; if (storeOpen) { openCloseBtn.tint = 0x00ff00; // Green when open openCloseText.setText('OPEN'); } else { openCloseBtn.tint = 0xff0000; // Red when closed openCloseText.setText('CLOSED'); } } }; // Create queue line var queueLine = game.addChild(LK.getAsset('queueLine', { anchorX: 0.5, anchorY: 0.5 })); queueLine.x = 1024; // Center of screen queueLine.y = counterY - 300; // Position above cash register // Create black rectangle first (so it appears behind) var blackRect = LK.getAsset('blackRectangle', { anchorX: 0.5, anchorY: 0 }); blackRect.y = 135; // Position behind the money text LK.gui.top.addChild(blackRect); // Create day counter display in top left var dayTxt = new Text2('Day ' + currentDay, { size: 50, fill: 0x000000 }); dayTxt.anchor.set(0, 0); dayTxt.x = 150; // Position to avoid menu icon area LK.gui.topLeft.addChild(dayTxt); // Create money display (added after, so it appears on top) var scoreTxt = new Text2('₺' + money, { size: 60, fill: 0x006400 }); scoreTxt.anchor.set(0.5, 0); scoreTxt.y = 150; // Move money display lower LK.gui.top.addChild(scoreTxt); // Create instructions var instructionsTxt = new Text2('Tap items to scan them!', { size: 40, fill: 0x0000 }); instructionsTxt.anchor.set(0.5, 0); instructionsTxt.y = 80; LK.gui.top.addChild(instructionsTxt); // Create customer counter displays in top right var spawnedCounterTxt = new Text2('Spawned: 0', { size: 40, fill: 0x000000 }); spawnedCounterTxt.anchor.set(1, 0); LK.gui.topRight.addChild(spawnedCounterTxt); var exitedCounterTxt = new Text2('Exited: 0', { size: 40, fill: 0x000000 }); exitedCounterTxt.anchor.set(1, 0); exitedCounterTxt.y = 50; LK.gui.topRight.addChild(exitedCounterTxt); function spawnCustomer() { var customer = new Customer(); customer.x = 1024; // Center of screen customer.y = -200; // Above screen customers.push(customer); game.addChild(customer); totalCustomersSpawned++; // Increment customer counter // Customer shopping sequence var shelfIndex = 0; var _visitShelf = function visitShelf() { if (shelfIndex < shelves.length && customer.items.length < customer.itemsToCollect) { // Find shelves with available products var availableShelves = []; for (var s = 0; s < shelves.length; s++) { var shelf = shelves[s]; var hasAvailableProducts = false; for (var p = 0; p < shelf.products.length; p++) { if (shelf.products[p].available) { hasAvailableProducts = true; break; } } if (hasAvailableProducts) { availableShelves.push(shelf); } } // If no shelves have products, customer leaves without shopping if (availableShelves.length === 0) { // Done shopping (forced), join queue with current items customer.isShopping = false; customerQueue.push(customer); var queuePosition = queueLine.x + customerQueue.length * 200; tween(customer, { x: queuePosition, y: queueLine.y }, { duration: 1500 }); return; } // Select random shelf from available ones var targetShelf = availableShelves[Math.floor(Math.random() * availableShelves.length)]; tween(customer, { x: targetShelf.x, y: targetShelf.y + 250 }, { duration: 1500, onFinish: function onFinish() { customer.targetShelf = targetShelf; customer.collectItemFromShelf(); shelfIndex++; LK.setTimeout(function () { if (customer.items.length < customer.itemsToCollect) { _visitShelf(); } else { // Done shopping, join queue customer.isShopping = false; customerQueue.push(customer); var queuePosition = queueLine.x + customerQueue.length * 200; tween(customer, { x: queuePosition, y: queueLine.y }, { duration: 1500 }); } }, 500); } }); } }; // Start shopping by entering store tween(customer, { y: 400 }, { duration: 1000, onFinish: function onFinish() { _visitShelf(); } }); } function areAllShelvesEmpty() { for (var i = 0; i < shelves.length; i++) { var shelf = shelves[i]; for (var j = 0; j < shelf.products.length; j++) { if (shelf.products[j].available) { return false; } } } return true; } function showDaySummary() { gameOverPaused = true; // Create dark overlay var overlay = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5 })); overlay.x = 1024; overlay.y = 1366; overlay.alpha = 0; overlay.tint = 0x000000; // Create summary text var summaryTxt = new Text2('Day ' + currentDay + ' Complete!\n\nCustomers Served: ' + totalCustomersExited, { size: 60, fill: 0xffffff }); summaryTxt.anchor.set(0.5, 0.5); summaryTxt.x = 1024; summaryTxt.y = 1200; summaryTxt.alpha = 0; game.addChild(summaryTxt); // Create earnings display - centered and green var earningsTxt = new Text2(dailyEarnings + '₺', { size: 120, fill: 0x00ff00 }); earningsTxt.anchor.set(0.5, 0.5); earningsTxt.x = 1024; earningsTxt.y = 1700; earningsTxt.alpha = 0; game.addChild(earningsTxt); // Create continue button var continueBtn = game.addChild(LK.getAsset('continueButton', { anchorX: 0.5, anchorY: 0.5 })); continueBtn.x = 1024; continueBtn.y = 2400; continueBtn.alpha = 0; // Fade in animation tween(overlay, { alpha: 0.8 }, { duration: 1000 }); tween(summaryTxt, { alpha: 1 }, { duration: 1000 }); tween(earningsTxt, { alpha: 1 }, { duration: 1000 }); tween(continueBtn, { alpha: 1 }, { duration: 1000 }); // Handle continue button click continueBtn.down = function () { // Fade out animation tween(overlay, { alpha: 0 }, { duration: 1000 }); tween(summaryTxt, { alpha: 0 }, { duration: 1000 }); tween(earningsTxt, { alpha: 0 }, { duration: 1000 }); tween(continueBtn, { alpha: 0 }, { duration: 1000, onFinish: function onFinish() { // Remove summary elements after fade out overlay.destroy(); summaryTxt.destroy(); earningsTxt.destroy(); continueBtn.destroy(); gameOverPaused = false; startNextDay(); } }); }; } function startNextDay() { // Reset day variables currentDay++; dailyEarnings = 0; totalCustomersSpawned = 0; totalCustomersExited = 0; spawnTimer = 0; spawnDelay = 540; // Save progress to storage storage.currentDay = currentDay; storage.money = money; // Update day display dayTxt.setText('Day ' + currentDay); // Reset all shelves for (var i = 0; i < shelves.length; i++) { var shelf = shelves[i]; // Remove current products for (var j = 0; j < shelf.products.length; j++) { shelf.products[j].destroy(); } shelf.products = []; // Create new products shelf.createProducts(); } // Clear any remaining customers for (var i = customers.length - 1; i >= 0; i--) { customers[i].destroy(); } customers = []; customerQueue = []; currentCustomer = null; // Start spawning customers again LK.setTimeout(function () { spawnCustomer(); }, 1000); } function serveNextCustomer() { if (customerQueue.length > 0 && !currentCustomer) { currentCustomer = customerQueue.shift(); currentCustomer.isBeingServed = true; // Move customer to cash register tween(currentCustomer, { x: 896, y: queueLine.y }, { duration: 1500, onFinish: function onFinish() { if (currentCustomer && currentCustomer.parent) { currentCustomer.placeItemsOnCounter(); } } }); // Move other customers forward in queue - only move existing queue members for (var i = 0; i < customerQueue.length; i++) { var queuePos = queueLine.x + (i + 1) * 200; tween(customerQueue[i], { x: queuePos, y: queueLine.y }, { duration: 1000 }); } } } game.update = function () { // Don't update game logic during day summary if (gameOverPaused) { return; } // Hide/show instruction text based on shop state instructionsTxt.visible = !shopOpen; // Check if all shelves are empty and handle customers accordingly if (areAllShelvesEmpty()) { // Make customers who are still shopping leave without products for (var i = customers.length - 1; i >= 0; i--) { var customer = customers[i]; if (customer.isShopping && customer.items.length === 0) { // Customer leaves empty-handed tween(customer, { x: -200 }, { duration: 1000, onFinish: function onFinish() { totalCustomersExited++; customer.destroy(); } }); customers.splice(i, 1); } } // Don't spawn new customers when shelves are empty or store is closed } else if (storeOpen) { spawnTimer++; // Spawn new customers if (spawnTimer >= spawnDelay) { spawnCustomer(); spawnTimer = 0; // Gradually increase spawn rate if (spawnDelay > 120) { spawnDelay -= 2; } } } // Check if current customer transaction is complete if (currentCustomer && currentCustomer.isBeingServed) { // Shaking effect is now handled by tween animations instead of direct position manipulation // Only check for scanned items if customer hasn't left if (currentCustomer.parent && currentCustomer.allItemsScanned()) { currentCustomer.completeTransaction(); // Remove from customers array for (var i = customers.length - 1; i >= 0; i--) { if (customers[i] === currentCustomer) { customers.splice(i, 1); break; } } currentCustomer = null; // Serve next customer after a short delay LK.setTimeout(function () { serveNextCustomer(); }, 500); } // Check if customer left angry if (currentCustomer && !currentCustomer.parent) { // Remove from customers array for (var i = customers.length - 1; i >= 0; i--) { if (customers[i] === currentCustomer) { customers.splice(i, 1); break; } } currentCustomer = null; // Serve next customer after a short delay LK.setTimeout(function () { serveNextCustomer(); }, 500); } } // Serve next customer if none is being served if (!currentCustomer) { serveNextCustomer(); } // Update customer counter displays spawnedCounterTxt.setText('Spawned: ' + totalCustomersSpawned); exitedCounterTxt.setText('Exited: ' + totalCustomersExited); // Day end condition - when all shelves are empty and all customers have left if (areAllShelvesEmpty() && totalCustomersSpawned === totalCustomersExited && !gameOverPaused) { showDaySummary(); } // Game over condition - too many customers waiting if (customerQueue.length >= 5) { LK.showGameOver(); } }; // Create end day button in bottom right var endDayBtn = game.addChild(LK.getAsset('blackRectangle', { anchorX: 0.5, anchorY: 0.5 })); endDayBtn.x = 1800; endDayBtn.y = 2600; endDayBtn.width = 300; endDayBtn.height = 150; endDayBtn.tint = 0x444444; var endDayTxt = new Text2('End Day', { size: 40, fill: 0xffffff }); endDayTxt.anchor.set(0.5, 0.5); endDayTxt.x = 1800; endDayTxt.y = 2600; game.addChild(endDayTxt); // Handle end day button click endDayBtn.down = function () { if (!gameOverPaused && !shopOpen) { showDaySummary(); } }; // Create shop button in bottom left var shopBtn = game.addChild(LK.getAsset('shopButton', { anchorX: 0.5, anchorY: 0.5 })); shopBtn.x = 150; shopBtn.y = 2600; var shopBtnText = new Text2('Shop', { size: 30, fill: 0xffffff }); shopBtnText.anchor.set(0.5, 0.5); shopBtnText.x = 150; shopBtnText.y = 2600; game.addChild(shopBtnText); // Shop overlay variables var shopOverlay = null; var shopItems = []; var currentShopCategory = 'products'; // Handle shop button click // Shop overlay variables var currentShopCategory = 'products'; shopBtn.down = function () { if (!shopOverlay && !gameOverPaused) { shopOpen = true; // Function to clear current category items var clearCategoryItems = function clearCategoryItems() { // Remove category-specific items (keep overlay, title, category buttons, and close button) for (var i = shopItems.length - 1; i >= 0; i--) { if (shopItems[i].isCategoryItem) { shopItems[i].destroy(); shopItems.splice(i, 1); } } }; // Function to show products category var showProducts = function showProducts() { currentShopCategory = 'products'; clearCategoryItems(); var productItems = [{ name: 'Fresh Apples', price: 100, description: 'Restocks apple shelf' }, { name: 'Ripe Bananas', price: 150, description: 'Restocks banana shelf' }, { name: 'Sweet Oranges', price: 120, description: 'Restocks orange shelf' }, { name: 'Fresh Milk', price: 200, description: 'Restocks milk shelf' }, { name: 'Bread Loaves', price: 80, description: 'Restocks bread shelf' }, { name: 'Cheese Blocks', price: 180, description: 'Restocks cheese shelf' }]; // Create product cards for (var i = 0; i < productItems.length; i++) { var item = productItems[i]; var xPos = 340 + i % 3 * 340; var yPos = 700 + Math.floor(i / 3) * 400; // Item background var itemBg = game.addChild(LK.getAsset('shopItem', { anchorX: 0.5, anchorY: 0.5 })); itemBg.x = xPos; itemBg.y = yPos; itemBg.width = 300; itemBg.height = 350; itemBg.isCategoryItem = true; shopItems.push(itemBg); // Item name var itemName = new Text2(item.name, { size: 32, fill: 0x000000 }); itemName.anchor.set(0.5, 0.5); itemName.x = xPos; itemName.y = yPos - 100; itemName.isCategoryItem = true; game.addChild(itemName); shopItems.push(itemName); // Item description var itemDesc = new Text2(item.description, { size: 22, fill: 0x444444 }); itemDesc.anchor.set(0.5, 0.5); itemDesc.x = xPos; itemDesc.y = yPos - 50; itemDesc.isCategoryItem = true; game.addChild(itemDesc); shopItems.push(itemDesc); // Item price var itemPrice = new Text2(item.price + '₺', { size: 40, fill: 0x006400 }); itemPrice.anchor.set(0.5, 0.5); itemPrice.x = xPos; itemPrice.y = yPos; itemPrice.isCategoryItem = true; game.addChild(itemPrice); shopItems.push(itemPrice); // Buy button var buyBtn = game.addChild(LK.getAsset('buyButton', { anchorX: 0.5, anchorY: 0.5 })); buyBtn.x = xPos; buyBtn.y = yPos + 70; buyBtn.width = 200; buyBtn.height = 60; buyBtn.itemData = item; buyBtn.isCategoryItem = true; shopItems.push(buyBtn); var buyText = new Text2('Buy', { size: 28, fill: 0xffffff }); buyText.anchor.set(0.5, 0.5); buyText.x = xPos; buyText.y = yPos + 70; buyText.isCategoryItem = true; game.addChild(buyText); shopItems.push(buyText); // Buy button handler buyBtn.down = function () { if (money >= this.itemData.price) { money -= this.itemData.price; scoreTxt.setText(money + '₺'); storage.money = money; // Flash green to show purchase LK.effects.flashObject(this, 0x00ff00, 500); } }; } }; // Function to show equipment category var showEquipment = function showEquipment() { currentShopCategory = 'equipment'; clearCategoryItems(); var equipmentItems = [{ name: 'Extra Shelf', price: 500, description: 'Add more shelf space' }, { name: 'Refrigerator', price: 800, description: 'Keep dairy products fresh' }, { name: 'Fast Scanner', price: 300, description: 'Scan items faster' }, { name: 'Security Camera', price: 400, description: 'Reduce theft' }]; // Create equipment cards for (var i = 0; i < equipmentItems.length; i++) { var item = equipmentItems[i]; var xPos = 512 + i % 2 * 512; var yPos = 700 + Math.floor(i / 2) * 400; // Item background var itemBg = game.addChild(LK.getAsset('shopItem', { anchorX: 0.5, anchorY: 0.5 })); itemBg.x = xPos; itemBg.y = yPos; itemBg.width = 400; itemBg.height = 350; itemBg.isCategoryItem = true; shopItems.push(itemBg); // Item name var itemName = new Text2(item.name, { size: 36, fill: 0x000000 }); itemName.anchor.set(0.5, 0.5); itemName.x = xPos; itemName.y = yPos - 100; itemName.isCategoryItem = true; game.addChild(itemName); shopItems.push(itemName); // Item description var itemDesc = new Text2(item.description, { size: 24, fill: 0x444444 }); itemDesc.anchor.set(0.5, 0.5); itemDesc.x = xPos; itemDesc.y = yPos - 50; itemDesc.isCategoryItem = true; game.addChild(itemDesc); shopItems.push(itemDesc); // Item price var itemPrice = new Text2(item.price + '₺', { size: 50, fill: 0x006400 }); itemPrice.anchor.set(0.5, 0.5); itemPrice.x = xPos; itemPrice.y = yPos; itemPrice.isCategoryItem = true; game.addChild(itemPrice); shopItems.push(itemPrice); // Buy button var buyBtn = game.addChild(LK.getAsset('buyButton', { anchorX: 0.5, anchorY: 0.5 })); buyBtn.x = xPos; buyBtn.y = yPos + 70; buyBtn.width = 200; buyBtn.height = 60; buyBtn.itemData = item; buyBtn.isCategoryItem = true; shopItems.push(buyBtn); var buyText = new Text2('Buy', { size: 28, fill: 0xffffff }); buyText.anchor.set(0.5, 0.5); buyText.x = xPos; buyText.y = yPos + 70; buyText.isCategoryItem = true; game.addChild(buyText); shopItems.push(buyText); // Buy button handler buyBtn.down = function () { if (money >= this.itemData.price) { money -= this.itemData.price; scoreTxt.setText(money + '₺'); storage.money = money; // Flash green to show purchase LK.effects.flashObject(this, 0x00ff00, 500); } }; } }; // Function to show customization category var showCustomization = function showCustomization() { currentShopCategory = 'customization'; clearCategoryItems(); var customizeItems = [{ name: 'Store Sign', price: 200, description: 'Custom store branding' }, { name: 'Floor Tiles', price: 150, description: 'Improve store appearance' }, { name: 'Lighting', price: 300, description: 'Better store lighting' }, { name: 'Music System', price: 250, description: 'Background music' }]; // Create customization cards for (var i = 0; i < customizeItems.length; i++) { var item = customizeItems[i]; var xPos = 512 + i % 2 * 512; var yPos = 700 + Math.floor(i / 2) * 400; // Item background var itemBg = game.addChild(LK.getAsset('shopItem', { anchorX: 0.5, anchorY: 0.5 })); itemBg.x = xPos; itemBg.y = yPos; itemBg.width = 400; itemBg.height = 350; itemBg.isCategoryItem = true; shopItems.push(itemBg); // Item name var itemName = new Text2(item.name, { size: 36, fill: 0x000000 }); itemName.anchor.set(0.5, 0.5); itemName.x = xPos; itemName.y = yPos - 100; itemName.isCategoryItem = true; game.addChild(itemName); shopItems.push(itemName); // Item description var itemDesc = new Text2(item.description, { size: 24, fill: 0x444444 }); itemDesc.anchor.set(0.5, 0.5); itemDesc.x = xPos; itemDesc.y = yPos - 50; itemDesc.isCategoryItem = true; game.addChild(itemDesc); shopItems.push(itemDesc); // Item price var itemPrice = new Text2(item.price + '₺', { size: 50, fill: 0x006400 }); itemPrice.anchor.set(0.5, 0.5); itemPrice.x = xPos; itemPrice.y = yPos; itemPrice.isCategoryItem = true; game.addChild(itemPrice); shopItems.push(itemPrice); // Buy button var buyBtn = game.addChild(LK.getAsset('buyButton', { anchorX: 0.5, anchorY: 0.5 })); buyBtn.x = xPos; buyBtn.y = yPos + 70; buyBtn.width = 200; buyBtn.height = 60; buyBtn.itemData = item; buyBtn.isCategoryItem = true; shopItems.push(buyBtn); var buyText = new Text2('Buy', { size: 28, fill: 0xffffff }); buyText.anchor.set(0.5, 0.5); buyText.x = xPos; buyText.y = yPos + 70; buyText.isCategoryItem = true; game.addChild(buyText); shopItems.push(buyText); // Buy button handler buyBtn.down = function () { if (money >= this.itemData.price) { money -= this.itemData.price; scoreTxt.setText(money + '₺'); storage.money = money; // Flash green to show purchase LK.effects.flashObject(this, 0x00ff00, 500); } }; } }; // Category button handlers // Create white overlay shopOverlay = game.addChild(LK.getAsset('shopOverlay', { anchorX: 0.5, anchorY: 0.5 })); shopOverlay.x = 1024; shopOverlay.y = 1366; shopOverlay.alpha = 0.95; // Create shop title var shopTitle = new Text2('Market Shop', { size: 80, fill: 0x000000 }); shopTitle.anchor.set(0.5, 0.5); shopTitle.x = 1024; shopTitle.y = 200; game.addChild(shopTitle); shopItems.push(shopTitle); // Create category buttons var productsBtn = game.addChild(LK.getAsset('buyButton', { anchorX: 0.5, anchorY: 0.5 })); productsBtn.x = 400; productsBtn.y = 350; productsBtn.width = 250; productsBtn.height = 80; shopItems.push(productsBtn); var productsText = new Text2('Products', { size: 30, fill: 0xffffff }); productsText.anchor.set(0.5, 0.5); productsText.x = 400; productsText.y = 350; game.addChild(productsText); shopItems.push(productsText); var equipmentBtn = game.addChild(LK.getAsset('buyButton', { anchorX: 0.5, anchorY: 0.5 })); equipmentBtn.x = 1024; equipmentBtn.y = 350; equipmentBtn.width = 250; equipmentBtn.height = 80; shopItems.push(equipmentBtn); var equipmentText = new Text2('Equipment', { size: 30, fill: 0xffffff }); equipmentText.anchor.set(0.5, 0.5); equipmentText.x = 1024; equipmentText.y = 350; game.addChild(equipmentText); shopItems.push(equipmentText); var customizeBtn = game.addChild(LK.getAsset('buyButton', { anchorX: 0.5, anchorY: 0.5 })); customizeBtn.x = 1648; customizeBtn.y = 350; customizeBtn.width = 250; customizeBtn.height = 80; shopItems.push(customizeBtn); var customizeText = new Text2('Customize', { size: 30, fill: 0xffffff }); customizeText.anchor.set(0.5, 0.5); customizeText.x = 1648; customizeText.y = 350; game.addChild(customizeText); shopItems.push(customizeText); productsBtn.down = function () { showProducts(); }; equipmentBtn.down = function () { showEquipment(); }; customizeBtn.down = function () { showCustomization(); }; // Show default category (products) showProducts(); // Close button var closeBtn = game.addChild(LK.getAsset('blackRectangle', { anchorX: 0.5, anchorY: 0.5 })); closeBtn.x = 1024; closeBtn.y = 2400; closeBtn.width = 200; closeBtn.height = 100; shopItems.push(closeBtn); var closeText = new Text2('Close', { size: 40, fill: 0xffffff }); closeText.anchor.set(0.5, 0.5); closeText.x = 1024; closeText.y = 2400; game.addChild(closeText); shopItems.push(closeText); // Close button handler closeBtn.down = function () { // Remove all shop elements shopOverlay.destroy(); shopOverlay = null; for (var j = 0; j < shopItems.length; j++) { shopItems[j].destroy(); } shopItems = []; shopOpen = false; }; } }; // Initial customer spawn LK.setTimeout(function () { spawnCustomer(); }, 1000); // No changes required - the current implementation already makes angry customers walk out normally through the store entrance using tween animations;;
===================================================================
--- original.js
+++ change.js
@@ -736,8 +736,10 @@
// Don't update game logic during day summary
if (gameOverPaused) {
return;
}
+ // Hide/show instruction text based on shop state
+ instructionsTxt.visible = !shopOpen;
// Check if all shelves are empty and handle customers accordingly
if (areAllShelvesEmpty()) {
// Make customers who are still shopping leave without products
for (var i = customers.length - 1; i >= 0; i--) {
A shiny blue ball. In-Game asset. 2d. High contrast. No shadows
Üzerinde meyve, sebze gibi ürün bulundurmayan; market kasa bankosu. Üstten görünüm.. In-Game asset. 2d. High contrast. No shadows
Shiny apple. In-Game asset. 2d. High contrast. No shadows
Koparılmamış ve ayrılmamış, bir tutam muz. In-Game asset. 2d. High contrast. No shadows
Cheese. In-Game asset. 2d. High contrast. No shadows
Milk. In-Game asset. 2d. High contrast. No shadows
Orange. In-Game asset. 2d. High contrast. No shadows
Shelf. In-Game asset. 2d. High contrast. No shadows
Bread. In-Game asset. 2d. High contrast. No shadows
Continue button. In-Game asset. 2d. High contrast. No shadows
Cut this
Shop button. In-Game asset. 2d. High contrast. No shadows
A green Open button. In-Game asset. 2d. High contrast. No shadows
Rectangle red close button with "close" title. In-Game asset. 2d. High contrast. No shadows
Buy button. In-Game asset. 2d. High contrast. No shadows
Yiyecek kategorisi butonu. In-Game asset. 2d. High contrast. No shadows
Eşya kategorisi butonu. Üstünde "furniture" yazsın. In-Game asset. 2d. High contrast. No shadows
Kişiselleştirme kategorisi butonu. Boyutu 250x125 olsun. Çekiç sembolü olabilir. Rengi turuncu olsun. Yazı ingilizce olsun. Duş çerçevesi siyah olsun.. In-Game asset. 2d. High contrast. No shadows
İtem çerçevesi. In-Game asset. 2d. High contrast. No shadows