User prompt
add customers one by one to make sure they keep distance between them
User prompt
add a gauge bar, below each player. it will decrease by time
User prompt
Please fix the bug: 'ReferenceError: safeDistance is not defined' in or related to this line: 'if (distance < safeDistance) {' Line Number: 68
User prompt
if a customer is too close to another customer when they stop moving, move it further
User prompt
mke sure there is more space between customers
User prompt
sun should move even slower
User prompt
add sun that slowly moves from right to left or left to right in the top of the screen
User prompt
for customer use randomly any of the customer assets
User prompt
create level 8 to 18 and all should be like level 7
User prompt
level 8 and up, will be the same as level 7, but will have 1 less second in the timer. So level 8 will have 19 seconds, level 9 18 seconds and so on.
User prompt
when level 7 is complete, restart level one but only with 10 seconds
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'orderAsset1')' in or related to this line: 'if (customers[i].orderBubble.orderAsset1 && customers[i].orderBubble.orderAsset1.alpha === 1) {' Line Number: 424
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'orderAsset1')' in or related to this line: 'if (customers[i].orderBubble.orderAsset1 && customers[i].orderBubble.orderAsset1.alpha === 1) {' Line Number: 424
User prompt
Reuse customer to improve performmnace
User prompt
Improve game performannce
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of null (setting 'visible')' in or related to this line: 'customer.orderBubble.visible = true;' Line Number: 353
User prompt
instead of destroying customer, re used them, and just make them invisible and have them start eh next level with ne requests
Code edit (1 edits merged)
Please save this source code
User prompt
make level up perfomnce better
User prompt
if customer dont need one of the items ,black it ouot
User prompt
Please fix the bug: 'ReferenceError: customer is not defined' in or related to this line: 'customer.levelTransitionStart = LK.ticks;' Line Number: 431
User prompt
iproove logic for interval an timwout calls
User prompt
stop timer when last customer order is complete
User prompt
do not remoe items from bottom on new level
===================================================================
--- original.js
+++ change.js
@@ -317,9 +317,9 @@
function createCustomer() {
if (customers.length >= currentLevel.customerCount) {
return;
}
- var customer = new Customer();
+ var customer = customers.length < currentLevel.customerCount ? new Customer() : customers.shift();
var safeDistance = 500; // Minimum distance between customers
var validPosition = false;
while (!validPosition) {
customer.x = Math.random() * (2048 * 0.8) + 2048 * 0.1; // Spawn customers within the middle 80% of the screen
@@ -337,23 +337,21 @@
return 0.5 - Math.random();
}).slice(0, Math.floor(Math.random() * 2) + 1);
customer.setOrder(order);
// Ensure items are made visible if any customer needs that item
+ var inventorySet = new Set(inventory.map(function (invItem) {
+ return invItem.getType();
+ }));
order.forEach(function (item) {
- var inventoryItem = inventory.find(function (invItem) {
- return invItem.getType() === item;
- });
- if (inventoryItem) {
- inventoryItem.visible = true;
- inventoryItem.alpha = 1; // Make the item fully visible
+ if (inventorySet.has(item)) {
+ var inventoryItem = inventory.find(function (invItem) {
+ return invItem.getType() === item;
+ });
+ if (inventoryItem) {
+ inventoryItem.visible = true;
+ }
}
});
- // Black out items that are not needed by any customer
- inventory.forEach(function (invItem) {
- if (!order.includes(invItem.getType())) {
- invItem.alpha = 0.5; // Dim the item
- }
- });
customers.push(customer);
customer.rotation = 0;
game.addChild(customer);
game.addChild(customer.shadow);
@@ -417,11 +415,13 @@
levelupAsset.destroy();
currentLevel = levels[nextLevelIndex];
// Clear current customers and items
for (var i = 0; i < customers.length; i++) {
- customers[i].destroy();
+ customers[i].x = -200;
+ customers[i].y = -200;
+ customers[i].orderBubble.visible = false;
+ customers[i].shadow.visible = false;
}
- customers = [];
// Ensure items are always visible at the bottom of the screen
for (var i = 0; i < items.length; i++) {
items[i].visible = true;
}
@@ -436,21 +436,11 @@
return invItem.getType() === item;
});
if (inventoryItem) {
inventoryItem.visible = true;
- inventoryItem.alpha = 1; // Make the item fully visible
}
});
});
- // Black out items that are not needed by any customer
- inventory.forEach(function (invItem) {
- var needed = customers.some(function (customer) {
- return customer.getOrder().includes(invItem.getType());
- });
- if (!needed) {
- invItem.alpha = 0.5; // Dim the item
- }
- });
// Ensure items are always visible at the bottom of the screen
// Reset timer for the new level
levelTimer = 20;
timeTxt.setText('Time: ' + levelTimer);
@@ -477,9 +467,9 @@
}, 1000);
}, 1000);
}, 1000);
}
- } else if (LK.ticks % 300 == 0) {
+ } else if (LK.ticks % 600 == 0) {
createCustomer();
}
};
// Initialize items only once
8bit. cartoon. icecream. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon and 8 bit message. reads: Time's Up!. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8bit. cartoon. palm tree.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.