User prompt
Make the cookies auto spawn
User prompt
Add more cookies
User prompt
Please fix the bug: 'ReferenceError: cookies is not defined' in or related to this line: 'for (var k = 0; k < cookies.length; k++) {' Line Number: 147
User prompt
Turn cookies into obstacles
User prompt
Touch a ingredient to make something new
User prompt
Add cookie object
User prompt
Background back to normal size
User prompt
Shrink the background
User prompt
Add a background
Initial prompt
The cake
===================================================================
--- original.js
+++ change.js
@@ -20,9 +20,14 @@
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
- // Cookie specific update logic
+ // Move the cookie downwards
+ self.y += 5;
+ // If the cookie is off the screen, destroy it
+ if (self.y > 2732) {
+ self.destroy();
+ }
};
});
// Ingredient class
var Ingredient = Container.expand(function () {
@@ -126,15 +131,32 @@
createCookie();
}
// Update game every tick
game.update = function () {
- // Update cakes and ingredients
+ // Update cakes, ingredients and cookies
for (var i = 0; i < cakes.length; i++) {
cakes[i].update();
+ // Check for collision between cakes and cookies
+ for (var k = 0; k < cookies.length; k++) {
+ if (cakes[i].intersects(cookies[k])) {
+ // Decrease score
+ score -= 1;
+ updateScore();
+ // Destroy cake and cookie
+ cakes[i].destroy();
+ cakes.splice(i, 1);
+ cookies[k].destroy();
+ cookies.splice(k, 1);
+ break;
+ }
+ }
}
for (var j = 0; j < ingredients.length; j++) {
ingredients[j].update();
}
+ for (var k = 0; k < cookies.length; k++) {
+ cookies[k].update();
+ }
// Create new ingredients periodically
if (LK.ticks % 60 == 0) {
createIngredient();
}
Cake. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cake ingredients. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Bluno cookies cartoon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.Bluno