Code edit (2 edits merged)
Please save this source code
User prompt
Update score every 2 second
Code edit (6 edits merged)
Please save this source code
User prompt
add a background фон below the background небо
User prompt
add background небо
Code edit (1 edits merged)
Please save this source code
User prompt
add background фон
User prompt
add background фон
User prompt
when you die, the glasses in the upper right corner of the screen are not displayed
User prompt
when you die, the glasses in the upper right corner of the screen are not displayed
User prompt
When you die, the glasses in the upper right corner of the screen are displayed
Code edit (1 edits merged)
Please save this source code
User prompt
show the points scored after death in the center of the screen
User prompt
obstacles rotate counterclockwise
User prompt
Add background "sky and sea"
User prompt
the obstacle rotates counterclockwise
Code edit (2 edits merged)
Please save this source code
User prompt
При смерте, указывать количество очков в центре экрана
Code edit (2 edits merged)
Please save this source code
User prompt
в правом верхнем углу добавить счетчик баллов, который каждую секунду увеличивает счет на 1, начинается с 0
Code edit (13 edits merged)
Please save this source code
User prompt
new obstacles appear every second
User prompt
Add an obstacle to the right side of the screen
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -58,25 +58,40 @@
// Add touch event listener to make bird move up and down smoothly
game.on('down', function (obj) {
bird.flyUp = true;
});
+var obstacles = [];
+var obstacleCreationCounter = 0;
LK.on('tick', function () {
bird.move();
- obstacle.move();
+ // Create a new obstacle every 60 ticks (approximately 1 second)
+ obstacleCreationCounter++;
+ if (obstacleCreationCounter >= 60) {
+ var newObstacle = game.addChild(new Obstacle());
+ newObstacle.x = 2048; // Start at the right edge of the screen
+ newObstacle.y = Math.random() * 2732; // Start at a random height
+ obstacles.push(newObstacle);
+ obstacleCreationCounter = 0;
+ }
+ // Move each obstacle and check for collisions
+ for (var i = 0; i < obstacles.length; i++) {
+ var obstacle = obstacles[i];
+ obstacle.move();
+ // Check if bird has collided with the obstacle
+ if (bird.intersects(obstacle)) {
+ // Flash screen red for 1 second (1000ms) to show game over.
+ LK.effects.flashScreen(0xff0000, 1000);
+ // Show game over. The game will be automatically paused while game over is showing.
+ LK.showGameOver();
+ }
+ }
// Check if bird has fallen off the screen or risen above the screen
if (bird.y > 2732 || bird.y < 0) {
// Flash screen red for 1 second (1000ms) to show game over.
LK.effects.flashScreen(0xff0000, 1000);
// Show game over. The game will be automatically paused while game over is showing.
LK.showGameOver();
}
- // Check if bird has collided with the obstacle
- if (bird.intersects(obstacle)) {
- // Flash screen red for 1 second (1000ms) to show game over.
- LK.effects.flashScreen(0xff0000, 1000);
- // Show game over. The game will be automatically paused while game over is showing.
- LK.showGameOver();
- }
});
// Initialize bird and obstacles
// Yellow bird
// Brown obstacles;
голубое небо, горизонт и зеленое поле. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Мультяшный квадратный сюрикен. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
button leaderboards. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.