User prompt
change game tick event to ensure you can't get a game over at start up of game
User prompt
ensure only one customer per round. A round is player attempt to catch one customers order
User prompt
ensure that customers enter left screen, but stop on the left side of the screen until the player has either failed or suceeded. once the player fails or suceeds order, customer exits right off screen.
User prompt
Player can collect the order ingredients in any sequence as long as they are the correct ingredients
User prompt
Ensure that the customer stays put on the left-hand of the screen until the player has either succeeded or failed at getting all three ingredients in the cup
User prompt
Fix Bug: 'TypeError: null is not an object (evaluating 'customer.order')' in this line: 'if (customer.order.ingredients.includes(ingredients[a].id) && !bubbleTea.ingredients.includes(ingredients[a].id)) {' Line Number: 145
User prompt
Categorize each customer interaction as a Round. The next Round cannot begin until the last has ended. The next customer cannot enter the screen until the previous customer has left the screen off the right side.
User prompt
Create a one second buffer between each round
User prompt
Fix Bug: 'TypeError: null is not an object (evaluating 'customer.x')' in this line: 'if (customer.x < 0) {' Line Number: 127
User prompt
reset the state of the `bubbleTea` object and the `customer` object after a successful catch or a failure to catch all the ingredients. When the `bubbleTea` object catches the correct ingredients and the customer's order is fulfilled, the customer is destroyed and set to null, and the `bubbleTea`'s ingredients array is reset to an empty array. However, if the `bubbleTea` object catches incorrect ingredients or not all ingredients, the customer is not reset properly, and the game does not handle the scenario where the `bubbleTea` object needs to start catching ingredients for a new customer's order. The game logic needs to ensure that after each round—whether successful or not—the game state is reset to allow for a new customer to appear with a new order and for the `bubbleTea` object to be ready to catch new ingredients. This includes resetting the `bubbleTea` ingredients array and ensuring a new customer instance is created and handled correctly. Without this reset, the game cannot proceed to subsequent rounds of catching ingredients.
User prompt
Fix Bug: 'TypeError: null is not an object (evaluating 'customer.order')' in this line: '} else if (bubbleTea.ingredients.sort().join() === customer.order.ingredients.sort().join()) {' Line Number: 138
User prompt
All customers require 3 ingredients before they exit.
User prompt
Destroy ingredients when they hit bottom of screen
User prompt
1. **Track Order Completion**: Implement a mechanism to track whether the player has collected all the ingredients of the order. This could involve checking the length of the `bubbleTea.ingredients` array against the length of the `customer.order.ingredients` array and comparing the sorted contents of both arrays to ensure they match.
User prompt
2. **Customer Movement Logic**: Modify the customer movement logic to only move the customer off the screen once the order is either completed or failed. This means the customer should not move based on the collection of a single ingredient.
User prompt
Fix Bug: 'TypeError: null is not an object (evaluating 'customer.order')' in this line: '} else if (bubbleTea.ingredients.length == customer.order.ingredients.length && bubbleTea.ingredients.sort().join() === customer.order.ingredients.sort().join()) {' Line Number: 129
User prompt
3. **Order Failure Condition**: Define a condition that determines when the player has failed the order. This could be a time limit or a wrong ingredient collected. Once the failure condition is met, the customer should start moving off the screen.
User prompt
Fix Bug: 'TypeError: null is not an object (evaluating 'customer.x')' in this line: 'customer.x += 20;' Line Number: 162
User prompt
4. **Customer Exit**: Once the order is completed or failed, initiate the customer's exit by incrementally increasing the customer's `x` position in each tick until the customer is off the screen to the right. Ensure that the customer's `x` position does not exceed `2048 + customer.width` to avoid unnecessary updates once the customer is no longer visible.
User prompt
5. **Resetting the State**: After the customer has moved off the screen, reset the necessary game state variables, such as clearing the `bubbleTea.ingredients` array and setting the `customer` variable to `null`, so that a new customer can be generated.
User prompt
Fix Bug: 'TypeError: null is not an object (evaluating 'customer.x')' in this line: 'customer.x += 20;' Line Number: 166
User prompt
Fix Bug: 'TypeError: null is not an object (evaluating 'customer.x')' in this line: 'customer.x += 20;' Line Number: 168
User prompt
Fix Bug: 'TypeError: null is not an object (evaluating 'customer.x')' in this line: 'customer.x += 20;' Line Number: 168
User prompt
Create code block that currently removes the customer prematurely is either removed or modified to only trigger under the correct conditions (i.e., after the order is completed or failed)
User prompt
Fix Bug: 'TypeError: null is not an object (evaluating 'customer.x')' in this line: 'customer.x += 20;' Line Number: 168
var Order = Container.expand(function () {
var self = Container.call(this);
self.ingredients = [];
for (var i = 0; i < 3; i++) {
self.ingredients.push(Math.floor(Math.random() * 5));
}
});
var SpeechBubble = Container.expand(function (text) {
var self = Container.call(this);
var bubbleGraphics = self.createAsset('speechBubble', 'Speech Bubble', .5, .5);
var maxIngredients = Math.floor(bubbleGraphics.width / 50);
for (var i = 0; i < Math.min(text.length, maxIngredients); i++) {
var ingredientGraphic = self.createAsset('ingredient' + text[i], 'Ingredient', .5, .5);
ingredientGraphic.scale.set(0.5);
ingredientGraphic.x = i * ((bubbleGraphics.width + 10) / maxIngredients) + i * 10 + ingredientGraphic.width / 2 - 100 + i * 10;
self.addChild(ingredientGraphic);
}
});
var Customer1 = Container.expand(function () {
var self = Container.call(this);
var customerGraphics = self.createAsset('customer1', 'Customer1', .5, .5);
self.order = new Order();
if (self.speechBubble) {
self.speechBubble.destroy();
}
self.speechBubble = self.addChild(new SpeechBubble(self.order.ingredients));
self.speechBubble.y = -self.speechBubble.height - 30;
self.speechBubble.x += 100;
});
var Customer2 = Container.expand(function () {
var self = Container.call(this);
var customerGraphics = self.createAsset('customer2', 'Customer2', .5, .5);
self.order = new Order();
if (self.speechBubble) {
self.speechBubble.destroy();
}
self.speechBubble = self.addChild(new SpeechBubble(self.order.ingredients));
self.speechBubble.y = -self.speechBubble.height - 30;
self.speechBubble.x += 100;
});
var Customer3 = Container.expand(function () {
var self = Container.call(this);
var customerGraphics = self.createAsset('customer3', 'Customer3', .5, .5);
self.order = new Order();
if (self.speechBubble) {
self.speechBubble.destroy();
}
self.speechBubble = self.addChild(new SpeechBubble(self.order.ingredients));
self.speechBubble.y = -self.speechBubble.height - 30;
self.speechBubble.x += 100;
});
var BubbleTea = Container.expand(function () {
var self = Container.call(this);
var teaGraphics = self.createAsset('bubbleTea', 'Bubble Tea', .5, .5);
self.ingredients = [];
self.speed = 10;
self.catch = function (ingredient) {
self.ingredients.push(ingredient);
};
self.move = function (direction) {
self.x += self.speed * direction;
if (self.x < teaGraphics.width / 2) self.x = teaGraphics.width / 2;
if (self.x > 2048 - teaGraphics.width / 2) self.x = 2048 - teaGraphics.width / 2;
if (self.y < teaGraphics.height / 2) self.y = teaGraphics.height / 2;
if (self.y > 2732 - teaGraphics.height / 2) self.y = 2732 - teaGraphics.height / 2;
};
});
var Ingredient = Container.expand(function (id) {
var self = Container.call(this);
self.id = id;
self.speed = Math.random() * 10 + 6;
var ingredientGraphics = self.createAsset('ingredient' + id, 'Ingredient', .5, .5);
self.move = function () {
self.y += self.speed;
if (self.y > 2732) {
self.y = 2732;
}
if (self.x < ingredientGraphics.width / 2) self.x = ingredientGraphics.width / 2;
if (self.x > 2048 - ingredientGraphics.width / 2) self.x = 2048 - ingredientGraphics.width / 2;
};
self.add = function () {};
});
var Game = Container.expand(function () {
var self = Container.call(this);
var score = 0;
var scoreTxt = new Text2(score.toString(), {
size: 100,
fill: '#FFA500'
});
scoreTxt.anchor.set(0.5, 0.5);
var scoreBox = LK.getAsset('scoreBox', 'Score Box', 0, 0);
scoreBox.width = 200;
scoreBox.height = 100;
scoreBox.x = 2048 - scoreBox.width / 2;
scoreBox.y = 2732 - scoreBox.height / 2;
self.addChild(scoreBox);
scoreBox.addChild(scoreTxt);
scoreTxt.x = scoreBox.width / 2;
scoreTxt.y = scoreBox.height / 2;
self.updateScore = function (newScore) {
score = newScore;
scoreTxt.setText(score.toString());
};
var background = self.createAsset('background', 'Game Background', 0.5, 0.5);
self.addChild(background);
background.width = 2048;
background.height = 2732;
background.x = 2048 / 2;
background.y = 2732 / 2;
var ingredients = [];
var customer;
var bubbleTea = self.addChild(new BubbleTea());
bubbleTea.x = 2048 / 2;
bubbleTea.y = 2732 - bubbleTea.height / 2;
LK.on('tick', function () {
if (!customer || customer.x > 2048 + customer.width) {
if (customer) customer.destroy();
var CustomerClass = [Customer1, Customer2, Customer3][Math.floor(Math.random() * 3)];
customer = self.addChild(new CustomerClass());
customer.x = -customer.width;
customer.y = 2732 - customer.height / 2;
}
customer.x += 20;
});
stage.on('move', function (obj) {
var event = obj.event;
var pos = event.getLocalPosition(self);
bubbleTea.x = pos.x;
});
LK.on('tick', function () {
for (var a = ingredients.length - 1; a >= 0; a--) {
ingredients[a].move();
if (bubbleTea.ingredients.length > 0 && bubbleTea.ingredients.sort().join() !== customer.order.ingredients.sort().join()) {
LK.showGameOver();
} else if (bubbleTea.intersects(ingredients[a])) {
if (customer.order.ingredients.includes(ingredients[a].id)) {
bubbleTea.catch(ingredients[a].id);
ingredients[a].destroy();
ingredients.splice(a, 1);
self.updateScore(score + ingredients[a].speed);
if (bubbleTea.ingredients.sort().join() === customer.order.ingredients.sort().join()) {
customer.x = 2048 + customer.width;
bubbleTea.ingredients = [];
}
}
}
}
if (LK.ticks % 60 == 0) {
var newIngredient = new Ingredient(Math.floor(Math.random() * 5));
newIngredient.x = Math.random() * 2048;
newIngredient.y = -newIngredient.height;
ingredients.push(newIngredient);
self.addChild(newIngredient);
}
});
});
Fruit jelly boba pearls, no cup Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pile of Fruit jelly boba pearls, no cup Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
kawaii harajuku customer, mask, Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
fruit shiny anime, no face Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
boba pearls, pile, no cup, shiny anime Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
red bean, shiny anime, pile no cup Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
shiny plastic cup, no lid, anime, empty Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
whipped milk foam, creamy fluff, anime, Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
flan pudding, shiny, anime Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
anime angry lines, red cross Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
boba tea shop logo, kawaii anime, circular logo Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Tea shop interior, anime cafe Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Speech bubble 💬, "don't drop!" Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
UI point box, white square Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.