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
@@ -15,17 +15,8 @@
self.shadow.y = customerGraphics.height / 2;
self.shadow.alpha = 0.5;
self.orderBubble = null;
self.gaugeBar = null;
- self.gaugeBar = LK.getAsset('gaugeBar', {
- anchorX: 0.5,
- anchorY: 1,
- width: 100,
- height: 10,
- color: 0x00ff00
- });
- self.gaugeBar.y = customerGraphics.height / 2 + 10;
- self.addChild(self.gaugeBar);
self.moveToPosition = function (x, y) {
var distance = Math.sqrt(Math.pow(self.x - x, 2) + Math.pow(self.y - y, 2));
var speed = distance / 120; // 60 frames per second
var dx = (x - self.x) / distance * speed;
@@ -38,10 +29,8 @@
self.shadow.x = self.x;
self.shadow.y = self.y + customerGraphics.height / 2;
self.orderBubble.x = self.x;
self.orderBubble.y = self.y - self.height / 2 - self.orderBubble.height / 2;
- self.gaugeBar.x = self.x;
- self.gaugeBar.y = self.y + customerGraphics.height / 2 + 10;
} else {
self.x = x;
self.y = y;
self.orderBubble.alpha = 0;
@@ -306,17 +295,8 @@
}, 1000);
// Check if all orders are fulfilled
var allOrdersFulfilled = true;
for (var i = 0; i < customers.length; i++) {
- if (customers[i].gaugeBar.width > 0) {
- customers[i].gaugeBar.width -= 0.1;
- } else {
- // Handle customer timeout (e.g., remove customer)
- customers[i].destroy();
- customers.splice(i, 1);
- i--; // Adjust index after removal
- continue;
- }
if (customers[i].orderBubble.orderAsset1 && customers[i].orderBubble.orderAsset1.alpha === 1) {
allOrdersFulfilled = false;
break;
}
@@ -392,11 +372,17 @@
// Initialize level data
var levels = [new Level(1, 3, ['towel', 'umbrella']), new Level(2, 4, ['towel', 'umbrella', 'refreshment']), new Level(3, 5, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(4, 5, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(5, 6, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(6, 7, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(7, 8, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(8, 8, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(9, 8, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(10, 8, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(11, 8, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(12, 8, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(13, 8, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(14, 8, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(15, 8, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(16, 8, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(17, 8, ['towel', 'umbrella', 'refreshment', 'snack']), new Level(18, 8, ['towel', 'umbrella', 'refreshment', 'snack'])];
currentLevel = levels[0];
// Create initial customers
-for (var i = 0; i < currentLevel.customerCount; i++) {
- createCustomer();
+var customerIndex = 0;
+function addCustomer() {
+ if (customerIndex < currentLevel.customerCount) {
+ createCustomer();
+ customerIndex++;
+ LK.setTimeout(addCustomer, 500); // Add a delay of 500ms between each customer
+ }
}
+addCustomer();
// Update function
game.update = function () {
levelTxt.setText('LVL ' + currentLevel.levelNumber);
// Check if all orders are fulfilled
@@ -438,11 +424,10 @@
for (var i = 0; i < items.length; i++) {
items[i].visible = true;
}
// Create new customers for the next level
- for (var i = 0; i < currentLevel.customerCount; i++) {
- createCustomer();
- }
+ customerIndex = 0;
+ addCustomer();
// Ensure items are made visible if any customer needs that item
customers.forEach(function (customer) {
customer.getOrder().forEach(function (item) {
var inventoryItem = inventory.find(function (invItem) {
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.