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
User prompt
add fuction smooth take-off of a bird
Code edit (2 edits merged)
Please save this source code
User prompt
if the bird rose above the screen, then death
User prompt
if the bird dropped below the screen, then death
User prompt
add function the bird falls down, but when you click on the screen it flies up 400 px
User prompt
delete препядствия
User prompt
add fuction fly obstacles from right to left
User prompt
fix bug fly obstacles
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: obstacleGraphics is not defined' in or related to this line: 'obstacle.x = 2048 + obstacleGraphics.width; // Start just right of the screen' Line Number: 62
User prompt
obstacles fly horizontally in screen
User prompt
obstacles fly horizontally
User prompt
add function, if touch in screen птица It went up and down smoothly
Code edit (1 edits merged)
Please save this source code
User prompt
Птица dont move
Initial prompt
летающая птица
/**** * Classes ****/ // Assets will be automatically created based on usage in the code. // Bird class var Bird = Container.expand(function () { var self = Container.call(this); var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); self.speedY = 5; self.flyUp = false; self.move = function () { // Bird falls down self.y += self.speedY; // If bird is flying up, decrease its y position if (self.flyUp) { self.speedY -= 90; if (self.speedY <= -10) { self.flyUp = false; } } else { self.speedY += 10; if (self.speedY > 10) { self.speedY = 11; } } }; }); // Obstacle class var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = -5; self.move = function () { // Obstacle moves from right to left self.x += self.speedX; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Light blue background to simulate sky }); /**** * Game Code ****/ var bird = game.addChild(new Bird()); bird.x = 350; // Start in the middle of the screen horizontally bird.y = 1366; // Start in the middle of the screen vertically // 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(); // 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. // Display the final score at the center of the screen var gameOverScoreTxt = new Text2(score.toString(), { size: 200, fill: "#0000FF" }); gameOverScoreTxt.anchor.set(0.5, 0.5); // Anchor to the center gameOverScoreTxt.x = 2048 / 2; // Position at the center of the screen horizontally gameOverScoreTxt.y = 2732 / 2; // Position at the center of the screen vertically game.addChild(gameOverScoreTxt); 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. // Display the final score at the center of the screen var gameOverScoreTxt = new Text2(score.toString(), { size: 200, fill: "#0000FF" }); gameOverScoreTxt.anchor.set(0.5, 0.5); // Anchor to the center gameOverScoreTxt.x = 2048 / 4; // Position at the center of the screen horizontally gameOverScoreTxt.y = 2732 / 2; // Position at the center of the screen vertically game.addChild(gameOverScoreTxt); LK.showGameOver(); } }); // Initialize bird and obstacles // Yellow bird // Brown obstacles; var obstacle = game.addChild(new Obstacle()); obstacle.x = 2048; // Start at the right edge of the screen obstacle.y = Math.random() * 2732; // Start at a random height; // Initialize score counter var score = 0; var scoreTxt = new Text2(score.toString(), { size: 100, fill: "#0000FF" }); scoreTxt.anchor.set(1, 0); // Anchor to the top right corner LK.gui.topRight.addChild(scoreTxt); // Update score every second LK.setInterval(function () { score++; scoreTxt.setText(score.toString()); }, 1000);
===================================================================
--- original.js
+++ change.js
@@ -103,9 +103,9 @@
size: 200,
fill: "#0000FF"
});
gameOverScoreTxt.anchor.set(0.5, 0.5); // Anchor to the center
- gameOverScoreTxt.x = 2048 / 2; // Position at the center of the screen horizontally
+ gameOverScoreTxt.x = 2048 / 4; // Position at the center of the screen horizontally
gameOverScoreTxt.y = 2732 / 2; // Position at the center of the screen vertically
game.addChild(gameOverScoreTxt);
LK.showGameOver();
}
голубое небо, горизонт и зеленое поле. 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.