User prompt
Please fix the bug: 'Uncaught ReferenceError: GameOverBackgrund is not defined' in or related to this line: 'var go = new GameOverBackgrund();' Line Number: 1074
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
create a class and asset for GreenCheckmark
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'speechBubble = LK.getAsset('speechBubble', {' Line Number: 724
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (13 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: instructionTxt is not defined' in or related to this line: 'instructionTxt.setText('Tap to throw the javelin');' Line Number: 65
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (15 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'self.x += queueSpeed;' Line Number: 591
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
when a customer has received their drink, three little hearts should rise above their heads and disappear
Code edit (4 edits merged)
Please save this source code
User prompt
after speechBubble is destroyed and the itemsprite is set, move the itemsprite towards the rightmost customer while scaling it down to 0.2 over 1 second
===================================================================
--- original.js
+++ change.js
@@ -11,9 +11,9 @@
y: -780
});
self.down = function (x, y, obj) {
shop.visible = false;
- addCustomers(7);
+ addCustomers(dailyCustomerAmount);
};
});
var CustomerBase = Container.expand(function () {
var self = Container.call(this);
@@ -132,8 +132,9 @@
// IngredientButton class
var IngredientButton = Container.expand(function (i, k) {
var self = Container.call(this);
self.done = false;
+ self.correct = false;
var ingredientButtonGraphics = self.attachAsset('ingredientButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.75,
@@ -264,8 +265,9 @@
self.id = id;
self.price = price;
self.purchased = false;
self.maxed = false;
+ self.recipe = '';
var itemBg = self.attachAsset('shopItemBackground', {
anchorX: 0.5,
anchorY: 0.5
});
@@ -284,22 +286,30 @@
});
//orangeJuice, strawberryDrink, watermelonDrink, bananaMilkshake, berriesDrink, pinaDrink, mangoLassie
if (self.id == 'orangeJuice') {
nameTxt.setText('Orange Juice');
+ self.recipe = '- Orange\n- Ice Water';
} else if (self.id == 'strawberryDrink') {
nameTxt.setText('Strawberry Daiquiry');
+ self.recipe = '- Strawberry\n- Sugar\n- Ice Water';
} else if (self.id == 'watermelonDrink') {
nameTxt.setText('Melon Slush');
+ self.recipe = '- Watermelon\n- Strawberry\n- Ice Water';
} else if (self.id == 'bananaMilkshake') {
nameTxt.setText('Banana Milkshake');
+ self.recipe = '- Banana\n- Milk\n- Ice';
} else if (self.id == 'berriesDrink') {
nameTxt.setText('Berries Lemonade');
+ self.recipe = '- Strawberry\n- Blueberry\n- Sugar\n- Ice Water';
} else if (self.id == 'pinaDrink') {
nameTxt.setText('Piña Colada');
+ self.recipe = '- Coconut\n- Pineapple\n- Milk';
} else if (self.id == 'mangoLassie') {
nameTxt.setText('Mango Lassie');
+ self.recipe = '- Mango\n- Sugar\n- Milk';
} else if (self.id == 'yacht') {
nameTxt.setText('Dream Boat');
+ self.recipe = 'Finally!\nMy dream boat\nis mine!';
}
//nameTxt.x = -self.width / 2;
nameTxt.x -= nameTxt.width / 2;
nameTxt.y = -self.height / 2 - nameTxt.height;
@@ -337,9 +347,13 @@
// Optionally, update the item's appearance to indicate it's not purchased
};
self.bought = function () {
//console.log('updateCost called');
- costTxt.destroy();
+ //costTxt.destroy();
+ costTxt.y += 26;
+ //costTxt.fill = '#cccccc';
+ costTxt.setText(self.recipe);
+ costTxt.x = -costTxt.width / 2;
upgradeButton.destroy();
bTxt.destroy();
self.maxed = true;
scoreTxt.setText('$ ' + coins);
@@ -776,40 +790,104 @@
y: speechBubble.y + item.offsetY
});
game.addChild(itemSprite);
// Display the ingredients of the ordered item at the bottom center of the screen
- /*ingredientsContainer = new Container();
- ingredientsContainer.x = 2048 / 2;
- ingredientsContainer.y = 2732 - 400;
- game.addChild(ingredientsContainer);
- game.addChild(ingredientsContainer);*/
- currentOrderedItemCompletion = 0;
- currentOrderedItemSize = item.ingredients.length;
- for (var i = 0; i < currentOrderedItemSize; i++) {
- var ingredientButton = new IngredientButton(i, item.ingredients[i]);
- ingredientButton.x = i * 400;
- ingredientButton.y = 2732 - 500;
- //ingredientsContainer.addChild(ingredientButton);
- game.addChild(ingredientButton);
- //ingredientButton.x += 400 * currentOrderedItemSize / 2;
- //ingredientButton.x += 400 * currentOrderedItemSize / 2;
- if (currentOrderedItemSize == 2) {
- ingredientButton.x += 800;
- } else if (currentOrderedItemSize == 3) {
- ingredientButton.x += 600;
- } else if (currentOrderedItemSize == 4) {
- ingredientButton.x += 400; // += 200;
+ if (false) {
+ currentOrderedItemCompletion = 0;
+ currentOrderedItemSize = item.ingredients.length;
+ for (var i = 0; i < currentOrderedItemSize; i++) {
+ var ingredientButton = new IngredientButton(i, item.ingredients[i]);
+ ingredientButton.x = i * 400;
+ ingredientButton.y = 2732 - 500;
+ game.addChild(ingredientButton);
+ if (currentOrderedItemSize == 2) {
+ ingredientButton.x += 800;
+ } else if (currentOrderedItemSize == 3) {
+ ingredientButton.x += 600;
+ } else if (currentOrderedItemSize == 4) {
+ ingredientButton.x += 400; // += 200;
+ }
+ ingredientButtons.push(ingredientButton);
}
- ingredientButtons.push(ingredientButton);
+ } else {
+ //TODO: maybe make a random or knowledge check to determine if player can make this recipe.
+ // Add the normal options.
+ var buttons = item.ingredients;
+ // Add 1 (or more?) wrong ingredient among the options.
+ var random = buttons[0];
+ while (buttons.includes(random)) {
+ random = allIngredients[Math.floor(Math.random() * allIngredients.length)];
+ }
+ var wrongIngredientButton = new IngredientButton(0, random);
+ wrongIngredientButton.right = false;
+ wrongIngredientButton.y = 2732 - 500;
+ game.addChild(wrongIngredientButton);
+ ingredientButtons.push(wrongIngredientButton);
+ // Add the right buttons.
+ // Let the buttons know if they're right or wrong for this recipe, so they can handle presses.
+ currentOrderedItemCompletion = 0;
+ currentOrderedItemSize = item.ingredients.length;
+ for (var i = 0; i < currentOrderedItemSize; i++) {
+ var ingredientButton = new IngredientButton(i, item.ingredients[i]);
+ //ingredientButton.x = i * 400;
+ ingredientButton.y = 2732 - 500;
+ ingredientButton.right = true;
+ game.addChild(ingredientButton);
+ /*if (currentOrderedItemSize == 2) {
+ ingredientButton.x += 800;
+ } else if (currentOrderedItemSize == 3) {
+ ingredientButton.x += 600;
+ } else if (currentOrderedItemSize == 4) {
+ ingredientButton.x += 400; // += 200;
+ }*/
+ ingredientButtons.push(ingredientButton);
+ }
+ //console.log('before ' + ingredientButtons[0].right);
+ //console.table([ingredientButtons[0], ingredientButtons[1], ingredientButtons[2]], ["correct"]);
+ // Shuffle and align the buttons
+ // Shuffle buttons using fisher-yates.
+ fy(ingredientButtons, 0, 0, 0);
+ for (var i = 0; i < ingredientButtons.length; i++) {
+ var ingredientButton = ingredientButtons[i];
+ ingredientButton.x = i * 400;
+ if (currentOrderedItemSize == 2) {
+ ingredientButton.x += 600;
+ } else if (currentOrderedItemSize == 3) {
+ ingredientButton.x += 400;
+ } else if (currentOrderedItemSize == 4) {
+ ingredientButton.x += 200; // += 200;
+ }
+ }
+ //console.log('after ' + ingredientButtons[0].right);
+ //console.table([ingredientButtons[0], ingredientButtons[1], ingredientButtons[2]], ["correct"]);
+ // Display a label 'Add the 2 (or 3 or 4) right ingredient.
+ instructionLabel = new Text2('Add the ' + currentOrderedItemSize + ' right ingredients.', {
+ size: 100,
+ fill: "#33ee33",
+ stroke: '#000000',
+ strokeThickness: 10,
+ weight: 300
+ });
+ instructionLabel.x = 0; //-instructionLabel.width / 2;
+ instructionLabel.y = 1200;
+ //instructionLabel.anchor.set(0.5, 0);
+ game.addChild(instructionLabel);
+ // How should wrong ingredient behave when pressed? Maybe move offscreen - with a -2$ sign shown in red?
}
- //ingredientsContainer.x = 1024; //(2048 - ingredientsContainer.width) / 2;
- //ingredientsContainer.x -= ingredientsContainer.width / 2 - 200;
// Add an empty glass
emptyGlass = new EmptyGlass();
game.addChild(emptyGlass);
emptyGlass.x = 1600;
emptyGlass.y = 1400;
}
+var instructionLabel;
+function fy(a, b, c, d) {
+ //array,placeholder,placeholder,placeholder
+ c = a.length;
+ while (c) {
+ b = Math.random() * c-- | 0, d = a[c], a[c] = a[b], a[b] = d;
+ }
+}
/**
* Generates an array of points along a two-point Bezier curve.
*
* @param {Object} start - The starting point of the curve {x: Number, y: Number}.
@@ -853,9 +931,9 @@
//customers[i].rotation += LK.ticks % 6 < 3 ? 0.05 : -0.05;
} /*
if (customers[i].happy && LK.ticks % 10 == 0) {
createHeartExplosion(customers[i].x, customers[i].y - 100);
- }*/
+ }*/
} else if (queueUpdateCounter >= queueUpdateMax && !orderPlaced) {
for (var i = 0; i < customers.length; i++) {
customers[i].rotation = 0;
customers[i].y = 1800;
A beautiful scenery looking out to sea from an empty beach side promenade on a bright summer day. Happy game illustration style for a casual family friendly game.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
remove the glass and the crate of lemons from the table.
A simple, elegant white speech bubble.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A lemon with a few slices cut off.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A bag of white sugar, open and with a pile of the sugar in front of it.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A pitcher full of nice fresh water and ice cubes.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round white button for an interface element.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An empty drinking glass.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A yellow star. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A red heart. simple.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A nice glass of watermelon and strawberry slushice. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A nice glass of banana milkshake. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A nice glass of pina colada. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A nice glass of mango lassie. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An orange. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A couple of blueberries. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A couple of bananas. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A bottle of milk. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A watermelon and some pieces of watermelon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A mango and a few slices of mango. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A pineapple with a few slices of pineapple in front. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A fullscreen background gui element for an in-game shop. It should be mostly blanks space, but along the edges there could be some structure or decorative vines and items, mostly related to fruits, berries, cocktails in a summer theme.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A modern dream of a sailing boat. game illustration.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A bold green checkmark.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An idyllic llustration of a beach cove where a blnd girl in a strawhat i en joying an enormous strawberry drink on her sailing boat as the sun sets. Clean game art illustration style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An idyllic llustration of a beach cove where a blond girl in a straw hat is enjoying an large strawberry drink on the deck of her sailing boat as the sun sets. Clean game illustration style.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.