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
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
// Cake class
var Cake = Container.expand(function () {
var self = Container.call(this);
var cakeGraphics = self.attachAsset('cake', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Cake specific update logic
};
});
// Ingredient class
var Ingredient = Container.expand(function () {
var self = Container.call(this);
var ingredientGraphics = self.attachAsset('ingredient', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Ingredient specific update logic
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize arrays and variables
var cakes = [];
var ingredients = [];
var score = 0;
// Create score text
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Function to update score
function updateScore() {
scoreTxt.setText(score);
}
// Function to create a new cake
function createCake() {
var newCake = new Cake();
newCake.x = Math.random() * 2048;
newCake.y = Math.random() * 2732;
cakes.push(newCake);
game.addChild(newCake);
}
// Function to create a new ingredient
function createIngredient() {
var newIngredient = new Ingredient();
newIngredient.x = Math.random() * 2048;
newIngredient.y = Math.random() * 2732;
ingredients.push(newIngredient);
game.addChild(newIngredient);
}
// Handle move events
function handleMove(x, y, obj) {
// Get event position in relation to game object
var game_position = game.toLocal(obj.global);
// Check for ingredient and cake collision
for (var i = 0; i < ingredients.length; i++) {
for (var j = 0; j < cakes.length; j++) {
if (ingredients[i].intersects(cakes[j])) {
// Increase score
score += 1;
updateScore();
// Destroy ingredient
ingredients[i].destroy();
ingredients.splice(i, 1);
// Flash cake
LK.effects.flashObject(cakes[j], 0xff0000, 1000);
break;
}
}
}
}
// Mouse or touch move on game object
game.move = handleMove;
// Create initial cakes and ingredients
for (var i = 0; i < 5; i++) {
createCake();
createIngredient();
}
// Update game every tick
game.update = function () {
// Update cakes and ingredients
for (var i = 0; i < cakes.length; i++) {
cakes[i].update();
}
for (var j = 0; j < ingredients.length; j++) {
ingredients[j].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