User prompt
move the ground asset left side towards the player along with the game movement
Code edit (1 edits merged)
Please save this source code
User prompt
move the ground asset liitle bit up to the screen from bottom
Code edit (4 edits merged)
Please save this source code
User prompt
Scale the ground asset a little bit larger
User prompt
scale the ground asset liitle bit larger
User prompt
destroy the bullets if they behind the player
User prompt
loop the background movement to the left of screen
User prompt
improve the size of the background image
User prompt
set the appropriate screen for the background asset
User prompt
fit the background asset for entire screen
User prompt
replace the backgroundcolor to background asset
User prompt
set the background asset as a background for the game
User prompt
turn it into sidescroller
Code edit (1 edits merged)
Please save this source code
User prompt
make this as a sidescrolled
User prompt
restrict player movement on x axis
User prompt
add default up and down player movement
Code edit (1 edits merged)
Please save this source code
User prompt
give random interval for each enemy spawn
User prompt
give random interval for each enemy spawn
User prompt
make enemy spawn only on horizontal starting from the right end of the screen
User prompt
start enemy spawn from the right end of the screen
User prompt
make enemy spawn only on horizontal
User prompt
defaultly player move from bottom to top of the screen
/**** * Classes ****/ var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { self.x += self.speed; if (self.x < 0) { self.destroy(); } }; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -3; self.update = function () { self.x += self.speed; if (self.x < 0 || self.x > 2048) { self.destroy(); } }; }); var Ground = Container.expand(function () { var self = Container.call(this); var groundGraphics = self.attachAsset('ground', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Ground does not move }; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { if (self.x < 0) { self.x = 0; } if (self.x > 2048) { self.x = 2048; } // Player only moves horizontally }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var ground = game.addChild(new Ground()); ground.x = 1024; ground.y = 2732 - 50; var player = game.addChild(new Player()); player.x = 1024; player.y = ground.y - 150; var enemies = []; var bullets = []; game.update = function () { if (LK.ticks % Math.floor(Math.random() * 100) == 0) { var enemy = game.addChild(new Enemy()); enemy.x = 2048; enemy.y = ground.y - 150; enemies.push(enemy); } for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; if (bullet.intersects(enemy)) { bullet.destroy(); bullets.splice(i, 1); enemy.destroy(); enemies.splice(j, 1); break; } } } }; game.down = function (x, y, obj) { var bullet = game.addChild(new Bullet()); bullet.x = player.x; bullet.y = player.y; bullets.push(bullet); }; game.move = function (x, y, obj) { player.x = x; // Player only moves horizontally };
===================================================================
--- original.js
+++ change.js
@@ -75,9 +75,9 @@
player.y = ground.y - 150;
var enemies = [];
var bullets = [];
game.update = function () {
- if (LK.ticks % Math.floor(Math.random() * 60) == 0) {
+ if (LK.ticks % Math.floor(Math.random() * 100) == 0) {
var enemy = game.addChild(new Enemy());
enemy.x = 2048;
enemy.y = ground.y - 150;
enemies.push(enemy);
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