User prompt
create a new asset and assign this asset as a overlay effect for this game
User prompt
Please fix the bug: 'Uncaught TypeError: LK.effects.explosion is not a function' in or related to this line: 'LK.effects.explosion(bullet.x, bullet.y, {' Line Number: 158
User prompt
Please fix the bug: 'Uncaught TypeError: LK.effects.smoke is not a function' in or related to this line: 'LK.effects.smoke(bullet.x, bullet.y, {' Line Number: 158
User prompt
add smoke vfx in game
User prompt
how to add vfx in this game
User prompt
Please fix the bug: 'TypeError: LK.effects.smokeScreen is not a function' in or related to this line: 'LK.effects.smokeScreen(0x808080, 1000);' Line Number: 152
User prompt
add smoke effect to the whole game
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
scale the bullet asset slightly better
Code edit (1 edits merged)
Please save this source code
User prompt
manage the player not to go beyond the screen both upside and downside
Code edit (2 edits merged)
Please save this source code
User prompt
scale the asset player little bit bigger
User prompt
scale the asset player little bit bigger
User prompt
scale the asset player little bit bigger
User prompt
save this process
User prompt
fix the game over screen popping up at start of the game
User prompt
fix the start position of the player which is same position as ground asset
Code edit (4 edits merged)
Please save this source code
User prompt
optimize the game
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ground is not defined' in or related to this line: 'player.y = ground.y - 150;' Line Number: 108
User prompt
increase spawn count of ground asset with +1
User prompt
if the player collides with the ground asset make this as game over
/**** * Classes ****/ var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0, anchorY: 0.6, scaleX: 4, scaleY: 4 }); 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, scaleX: 3, // Scale horizontally by 1.2 scaleY: 3 // Scale vertically by 1.2 }); self.update = function () { // Ground moves from right to left self.x -= 5; if (self.x + self.width < 0) { self.x = 2048; } }; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5, scaleX: 3, // Scale horizontally by 1.2 scaleY: 3 // Scale vertically by 1.2 }); self.speed = 5; self.update = function () { if (self.x < 0) { self.x = 0; } if (self.x > 300) { self.x = 300; } // Player only moves horizontally }; }); /**** * Initialize Game ****/ var game = new LK.Game(); /**** * Game Code ****/ var background1 = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366, width: 2048, height: 2732 })); var background2 = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 3072, y: 1366, width: 2048, height: 2732 })); var ground = game.addChild(new Ground()); ground.x = 1024; ground.y = 2732 - 200; // Move the ground asset a little bit up from the bottom of the screen var player = game.addChild(new Player()); player.x = 1024; player.y = ground.y - player.height; var enemies = []; var bullets = []; 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 % 60 == 0) { var enemy = game.addChild(new Enemy()); enemy.x = 2048; enemy.y = Math.random() * 2732; enemies.push(enemy); } for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; if (bullet.x < player.x) { bullet.destroy(); bullets.splice(i, 1); continue; } 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; } } } // Check if player collides with the ground asset if (player.intersects(ground) && player.y > ground.y) { // 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. } // Add smoke effect to the whole game LK.effects.smokeScreen(0x808080, 1000); }; 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.y = y; };
===================================================================
--- original.js
+++ change.js
@@ -3,12 +3,12 @@
****/
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
- anchorX: -1,
- anchorY: 1,
- scaleX: 1,
- scaleY: 1
+ anchorX: 0,
+ anchorY: 0.6,
+ scaleX: 4,
+ scaleY: 4
});
self.speed = 5;
self.update = function () {
self.x += self.speed;
@@ -138,8 +138,10 @@
if (player.intersects(ground) && player.y > ground.y) {
// 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.
}
+ // Add smoke effect to the whole game
+ LK.effects.smokeScreen(0x808080, 1000);
};
game.down = function (x, y, obj) {
var bullet = game.addChild(new Bullet());
bullet.x = player.x;
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