User prompt
Bg=grey
User prompt
Bg=Fly88
User prompt
Add 2 red lines in the middle of game
User prompt
Add 2 lines in the middle of game
User prompt
Bg=grey
User prompt
Bg=cyan
User prompt
At lines in the middle of game
User prompt
Add 2 black lines in the bottom
User prompt
Add 2 black lines in the middle of the game
User prompt
Add 2 lines in the middle of game
User prompt
Bg=grey
User prompt
Bg=black and white
User prompt
Bg=road
User prompt
Bg = light blue
User prompt
Bg = road
User prompt
Score = rock disappears
User prompt
If hero touch rock it disappears
User prompt
Decrease the quantity of obstacle
User prompt
Add rocks
User prompt
Remove rocks
User prompt
Rock = less quantity
User prompt
Increase the quantity of obstacle
User prompt
Les the rock
User prompt
Less rock
User prompt
Decrease in the quantity of rocks
===================================================================
--- original.js
+++ change.js
@@ -63,8 +63,22 @@
self.down = function (x, y, obj) {
hero.x += hero.speed;
};
});
+var Rock = Container.expand(function () {
+ var self = Container.call(this);
+ var rockGraphics = self.attachAsset('rock', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 5;
+ self.update = function () {
+ self.y += self.speed;
+ if (self.y > 2732) {
+ self.destroy();
+ }
+ };
+});
/****
* Initialize Game
****/
@@ -81,8 +95,9 @@
var hero = game.addChild(new Hero());
hero.x = leftButton.x;
hero.y = leftButton.y - 200; // Adjusted to ensure hero spawns above the left button
var obstacles = [];
+var rocks = [];
var dot = game.addChild(new Dot());
dot.x = 2048 / 2;
dot.y = 2732 / 2 - 100;
var score = 0;
@@ -115,8 +130,16 @@
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
+ // Update rocks
+ for (var i = rocks.length - 1; i >= 0; i--) {
+ rocks[i].update();
+ if (hero.intersects(rocks[i])) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ }
+ }
// Spawn new obstacles
if (LK.ticks % 20 == 0) {
for (var j = 0; j < 2; j++) {
// Spawn two obstacles at a time
@@ -127,8 +150,16 @@
obstacles.push(newObstacle);
game.addChild(newObstacle);
}
}
+ // Spawn new rocks
+ if (LK.ticks % 50 == 0) {
+ var newRock = new Rock();
+ newRock.x = Math.random() * 2048;
+ newRock.y = 0;
+ rocks.push(newRock);
+ game.addChild(newRock);
+ }
// Check if hero touches the left or right edge of the screen
if (hero.x <= 0 || hero.x >= 2048) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
Right button. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Road. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Road Car. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Coin. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.