User prompt
update score in 100 points when enemy dies
User prompt
create a scoreboard and increase score when enemy dies
Code edit (1 edits merged)
Please save this source code
User prompt
new bullet class does not affect the enemy
User prompt
make the enemy shoot new bullet class towards the player when appearing on the screen
User prompt
make the enemy shoot new bullet class towards the player
User prompt
make the enemy shoot new bullet class
User prompt
create a new bullet class and assign it to enemy
User prompt
make enemy class shoot bullets
User prompt
create another asset same as enemy class
User prompt
create another type of same enemy class
User prompt
destroy the blast effect after hitting the enemy
User prompt
change the blasting effect as a asset
User prompt
add a blasting effect when the enemy destroys
User prompt
Please fix the bug: 'TypeError: game.getChildrenByType is not a function' in or related to this line: 'var enemies = game.getChildrenByType(Enemy);' Line Number: 25
User prompt
Please fix the bug: 'TypeError: game.getChildrenByClass is not a function' in or related to this line: 'var enemies = game.getChildrenByClass(Enemy);' Line Number: 25
User prompt
when the bullet hits the enemy class the enemy should destroy
User prompt
add damage to bullet
User prompt
remove the player movement only on x axis
User prompt
create enemies like in space fighter game
User prompt
remove asteroids and its class
User prompt
spawn asteroids infront of the player
User prompt
move player only on x axis
User prompt
when i click the left mouse button the player character shoots a bullet
User prompt
create asteroids which are spawn randomly on the game
/**** * Classes ****/ // Bullet class var Bullet = Container.expand(function () { var self = Container.call(this); // Attach bullet asset var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); // Set bullet speed self.speed = -5; // Update function called every game tick self.update = function () { // Move bullet based on speed self.y += self.speed; }; }); // Player class var Player = Container.expand(function () { var self = Container.call(this); // Attach player asset var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); // Set player speed self.speed = 5; // Update function called every game tick self.update = function () { // Player movement is handled in game.move event }; }); /**** * Initialize Game ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ game.update = function () {}; var player = game.addChild(new Player()); // Set player initial position player.x = 1024; player.y = 2732 - player.height / 2 - 100; // Add mouse move event to the game game.move = function (x, y, obj) { // Move player only on x axis player.x = x; }; game.down = function (x, y, obj) { // Create a bullet instance var bullet = game.addChild(new Bullet()); // Set bullet initial position to player's position bullet.x = player.x; bullet.y = player.y; };
===================================================================
--- original.js
+++ change.js
@@ -1,23 +1,7 @@
/****
* Classes
****/
-// Asteroid class
-var Asteroid = Container.expand(function () {
- var self = Container.call(this);
- // Attach asteroid asset
- var asteroidGraphics = self.attachAsset('asteroid', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- // Set asteroid speed
- self.speed = -5;
- // Update function called every game tick
- self.update = function () {
- // Move asteroid based on speed
- self.y += self.speed;
- };
-});
// Bullet class
var Bullet = Container.expand(function () {
var self = Container.call(this);
// Attach bullet asset
@@ -60,18 +44,9 @@
/****
* Game Code
****/
-game.update = function () {
- // Spawn an asteroid every 60 ticks
- if (LK.ticks % 60 == 0) {
- // Create an asteroid instance
- var asteroid = game.addChild(new Asteroid());
- // Set asteroid initial position to player's x position and off the top of the screen
- asteroid.x = player.x;
- asteroid.y = -asteroid.height;
- }
-};
+game.update = function () {};
var player = game.addChild(new Player());
// Set player initial position
player.x = 1024;
player.y = 2732 - player.height / 2 - 100;
Space craft in facing forward. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
spacecraft in 4k
fire blast. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
asteroid. Single Game Texture. In-Game asset. 2d. No shadows
dark nebula galaxy 4k. Single Game Texture. In-Game asset. 2d. Blank background. No shadows