User prompt
create asteroids which are spawn randomly on the game
User prompt
move the player only when mouse input is detected
User prompt
remove enemy class and its code
User prompt
restrict the enemy movement only on x axis and forward
User prompt
add enemy which spawns and move towards the player
User prompt
when i click the left mouse button the player character shoots a bullet
User prompt
spawn the player little above on the scree
User prompt
spawn the player on the bottom part of the screen
User prompt
restrict the mouse input only to x axis
User prompt
use mouse as a input
User prompt
create a player class
User prompt
remove everything
User prompt
change this game into space fighter
User prompt
make enemy class to move towards the player
User prompt
make the enemy to move towards player
User prompt
generate game like 1941: Counter Attack
User prompt
remove everything
User prompt
remove space fighter
User prompt
create a space fighter game
User prompt
add a xwing
User prompt
create a asset and replace that asset with the default backgroundColor
User prompt
delete space fighter
User prompt
var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); replace the background color with asset and make this asset into lively background
User prompt
remove enemy laser and its code
User prompt
fit the game background with screen size
/**** * 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; }; }); // Enemy class var Enemy = Container.expand(function () { var self = Container.call(this); // Attach enemy asset var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); // Set enemy speed self.speed = 5; // Update function called every game tick self.update = function () { // Move enemy towards the player if (self.y < player.y) { self.y += self.speed; } else { self.y -= self.speed; } if (self.x < player.x) { self.x += self.speed; } else { self.x -= 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 () { // Move player based on speed self.x += self.speed; }; }); /**** * 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.down = function (x, y, obj) { // Create a bullet instance var bullet = game.addChild(new Bullet()); // Set bullet initial position bullet.x = player.x; bullet.y = player.y; }; var player = game.addChild(new Player()); // Set player initial position player.x = 1024; player.y = 2732 - player.height / 2 - 100; // Create an enemy instance var enemy = game.addChild(new Enemy()); // Set enemy initial position enemy.x = 1024; enemy.y = 0; // Add mouse move event to the game game.move = function (x, y, obj) { // Move player to mouse position player.x = x; };
===================================================================
--- original.js
+++ change.js
@@ -16,8 +16,33 @@
// Move bullet based on speed
self.y += self.speed;
};
});
+// Enemy class
+var Enemy = Container.expand(function () {
+ var self = Container.call(this);
+ // Attach enemy asset
+ var enemyGraphics = self.attachAsset('enemy', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Set enemy speed
+ self.speed = 5;
+ // Update function called every game tick
+ self.update = function () {
+ // Move enemy towards the player
+ if (self.y < player.y) {
+ self.y += self.speed;
+ } else {
+ self.y -= self.speed;
+ }
+ if (self.x < player.x) {
+ self.x += self.speed;
+ } else {
+ self.x -= self.speed;
+ }
+ };
+});
// Player class
var Player = Container.expand(function () {
var self = Container.call(this);
// Attach player asset
@@ -56,8 +81,13 @@
var player = game.addChild(new Player());
// Set player initial position
player.x = 1024;
player.y = 2732 - player.height / 2 - 100;
+// Create an enemy instance
+var enemy = game.addChild(new Enemy());
+// Set enemy initial position
+enemy.x = 1024;
+enemy.y = 0;
// Add mouse move event to the game
game.move = function (x, y, obj) {
// Move player to mouse position
player.x = x;
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