User prompt
adjust the road movement speed with a variable
User prompt
adjust the road movement speed with a variable
Code edit (2 edits merged)
Please save this source code
User prompt
display the score on the game over UI on the screen
User prompt
display the score on the game over screen
Code edit (7 edits merged)
Please save this source code
User prompt
display the scoreboard on the screen
User prompt
Create a scoreboard based on bike distance
Code edit (7 edits merged)
Please save this source code
User prompt
dont attach bullet to bike
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
create an asset called bullet and set spawn from the bike horizontally on the game
User prompt
remove bullet logic
User prompt
remove bullet asset
User prompt
remove make the bike asset to shoot every 5 seconds
Code edit (1 edits merged)
Please save this source code
User prompt
make the bike asset to shoot every 5 seconds
User prompt
attach the bullet to the bike
User prompt
make the bullet comes from the bike
User prompt
make the bike able to shoot
Code edit (1 edits merged)
Please save this source code
User prompt
spawn the obstacle3 asset in the game don't replace the obstacle2 and bike
User prompt
spawn the obstacle3 asset in the game
Code edit (3 edits merged)
Please save this source code
/**** * Classes ****/ var Bike = Container.expand(function () { var self = Container.call(this); var bikeGraphics = self.attachAsset('bike', { anchorX: 0, anchorY: -2.5, scaleX: 3, scaleY: 3 }); self.update = function () { self.x += 0.5; if (self.x > 2048) { self.x = -100; } }; self.jumping = false; self.jumpCounter = 0; self.shootCounter = 0; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: -3, anchorY: -2.3, scaleX: 3, scaleY: 3 }); self.update = function () { self.x -= 10; }; }); var Obstacle2 = Container.expand(function () { var self = Container.call(this); var obstacle2Graphics = self.attachAsset('obstacle2', { anchorX: -3, anchorY: 2.3, scaleX: 2, scaleY: 2 }); self.update = function () { self.x -= 10; self.y += 5; // Add a default downward movement for obstacle2 }; }); var Road = Container.expand(function () { var self = Container.call(this); var roadGraphics = self.attachAsset('road', { anchorX: 0.5, anchorY: 0.5 }); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var road = game.addChild(new Road()); road.x = 2048 / 2; road.y = 2732 / 2; var background1 = road; var background2 = new Road(); game.addChild(background2); background2.x = background1.x + 2048; background2.y = 2732 / 2; // Position background2 at the center of the screen vertically var bike = game.addChild(new Bike()); var obstacle = game.addChild(new Obstacle()); obstacle.x = 2048 / 2; obstacle.y = 2732 / 2; bike.x = 0; bike.y = 2732 / 2; var obstacle2; // Define obstacle2 in the global scope game.update = function () { background1.x -= 5; background2.x -= 5; if (background1.x <= -1024) { background1.x = background2.x + 2048; } if (background2.x <= -1024) { background2.x = background1.x + 2048; } if (LK.ticks % Math.floor(Math.random() * 1800) == 0) { // 60 ticks per second, so 1800 ticks = 30 seconds var newObstacle = new Obstacle(); newObstacle.x = 2048; // spawn at the right edge of the screen newObstacle.y = 2732 / 2; // spawn at the middle of the screen vertically game.addChild(newObstacle); obstacle2 = new Obstacle2(); // Assign the new Obstacle2 instance to the global obstacle2 variable obstacle2.x = 2048; // spawn at the right edge of the screen obstacle2.y = bike.y; // spawn at the player's vertical position game.addChild(obstacle2); } // Check if bike collides with obstacle2 if (bike.intersects(obstacle2)) { // Show game over. The game will be automatically paused while game over is showing. LK.showGameOver(); // Calling this will destroy the 'Game' and reset entire game state. } if (bike.jumping) { bike.y -= 50; bike.jumpCounter++; if (bike.jumpCounter > 20) { bike.jumping = false; } } else if (bike.y < 2732 / 2) { bike.y += 15; } else { bike.jumpCounter = 0; } }; game.down = function (x, y, obj) { if (!bike.jumping) { bike.jumping = true; } };
===================================================================
--- original.js
+++ change.js
@@ -18,20 +18,8 @@
self.jumping = false;
self.jumpCounter = 0;
self.shootCounter = 0;
});
-var Bullet = Container.expand(function () {
- var self = Container.call(this);
- var bulletGraphics = self.attachAsset('bullet', {
- anchorX: 0,
- anchorY: -2.5,
- scaleX: 2,
- scaleY: 2
- });
- self.update = function () {
- self.x += 10;
- };
-});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: -3,
sci fi bike with person riding facing right side Single Game Texture. In-Game asset. High contrast. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
sci fi bike with person riding facing right side Single Game Texture. In-Game asset. High contrast.
asteroid falling diffrent colors Single Game Texture. In-Game asset. High contrast. No Background