User prompt
if the player hits the enemey. the game is over
User prompt
make an enemy which is located on the same y position as the player. the enemy changes randomly its x position
User prompt
make the player scale by 30%. The player can not scale bigger than 150%
User prompt
if the score is minus 1, the game is over
User prompt
if a unhealthyFood is not caught by the player, then decrease the score by one
User prompt
make each falling food have a different speed
User prompt
instead of the healthyfood falling down from the top, make them fall down from the clouds. Basically the clouds spawn a new healtfood
User prompt
make clouds move from the left side to the right side
User prompt
make clouds go left to right
User prompt
add some cloud assets which move from right to left at the top
User prompt
create a background image
User prompt
scale the player by 10% each time the score increases by 5
User prompt
make the player graphic bigger by 5% every time the score is increased by 5
Initial prompt
Catch to scale
/**** * Classes ****/ // Cloud class var Cloud = Container.expand(function () { var self = Container.call(this); var cloudGraphics = self.attachAsset('cloud', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.move = function () { self.x -= self.speed; }; }); // Food class var Food = Container.expand(function (type) { var self = Container.call(this); var foodGraphics = self.attachAsset(type, { anchorX: 0.5, anchorY: 0.5 }); self.type = type; self.speed = Math.random() * 5 + 1; // Random speed between 1 and 6 self.move = function () { self.y += self.speed; }; }); // Assets will be automatically created based on usage in the code. // Player class var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Player update logic here }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Light blue background }); /**** * Game Code ****/ var background = game.addChild(LK.getAsset('background', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0 })); var player = game.addChild(new Player()); player.x = 1024; // Center horizontally player.y = 2500; // Near the bottom var foods = []; var score = 0; var scoreTxt = new Text2(score.toString(), { size: 150, fill: "#ffffff" }); LK.gui.top.addChild(scoreTxt); // Create food items at intervals var cloudCreationTimer = LK.setInterval(function () { var cloud = new Cloud(); cloud.x = 2048; // Start from the right cloud.y = Math.random() * 500; // Random position at the top game.addChild(cloud); }, 5000); var foodCreationTimer = LK.setInterval(function () { var foodType = Math.random() > 0.5 ? 'healthyFood' : 'unhealthyFood'; var food = new Food(foodType); food.x = Math.random() * 2048; // Random position across the width food.y = 0; // Start from the top foods.push(food); game.addChild(food); }, 2000); // Touch event to move player game.on('down', function (obj) { var pos = obj.event.getLocalPosition(game); player.x = pos.x; }); // Game tick LK.on('tick', function () { if (score === -1) { LK.showGameOver(); } player.update(); game.children.forEach(function (child) { if (child instanceof Cloud) { child.move(); if (child.x < -200) { // Off screen child.destroy(); } } }); for (var i = foods.length - 1; i >= 0; i--) { foods[i].move(); if (foods[i].y > 2732) { // Off screen if (foods[i].type === 'unhealthyFood') { score -= 1; scoreTxt.setText(score.toString()); } foods[i].destroy(); foods.splice(i, 1); } else if (player.intersects(foods[i])) { if (foods[i].type === 'unhealthyFood') { score += 1; } else { score -= 1; } scoreTxt.setText(score.toString()); if (score % 5 == 0) { if (player.scale.x < 1.5 && player.scale.y < 1.5) { player.scale.x *= 1.30; player.scale.y *= 1.30; } } foods[i].destroy(); foods.splice(i, 1); } } }); // Ensure the score is updated in the game scoreTxt.setText(LK.getScore().toString());
===================================================================
--- original.js
+++ change.js
@@ -117,10 +117,12 @@
score -= 1;
}
scoreTxt.setText(score.toString());
if (score % 5 == 0) {
- player.scale.x *= 1.10;
- player.scale.y *= 1.10;
+ if (player.scale.x < 1.5 && player.scale.y < 1.5) {
+ player.scale.x *= 1.30;
+ player.scale.y *= 1.30;
+ }
}
foods[i].destroy();
foods.splice(i, 1);
}
broccoli. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. 8bit
fat boy. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. 8bit. no background.
burger. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. 8bit. no background.
city with skyscrapers with a big street at the bottom. in-Game background asset. 2d. High contrast. No shadows. 8bit.
an evil rubber duck. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. 8bit
an evil broccoli airship. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. 8bit
an evil burger airship. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. 8bit