User prompt
add a los angalos backround
User prompt
Add a wall that aliens can not come through but you can shoot them.
User prompt
add higher alien spawn rate
User prompt
add barier infront of comand center and give it 20 health
User prompt
make speed of aliens slower
User prompt
make a quarter of the aliens gaurd the comand center
User prompt
make ending screen when comand center is hit 25 time you win
User prompt
Make half of aliens go to side of player to try to kill them
User prompt
reduce amount of aliens spawning by a little
User prompt
spawn more aliens at the same time
User prompt
make aliens move towards player. If player gets hit by 3 aliens end game
User prompt
if comand base gets shot 25 times end game
Initial prompt
Battle: Los Angelos
/**** * Classes ****/ // Alien class representing enemy characters var Alien = Container.expand(function () { var self = Container.call(this); var alienGraphics = self.attachAsset('alien', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { // Update logic for alien }; }); // Bullet class for projectiles var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 15; self.update = function () { self.y -= self.speed; }; }); // CommandBase class representing the target to destroy var CommandBase = Container.expand(function () { var self = Container.call(this); var baseGraphics = self.attachAsset('commandBase', { anchorX: 0.5, anchorY: 0.5 }); }); //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Hero class representing the player character var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.attachAsset('hero', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { // Update logic for hero }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize game elements var hero = game.addChild(new Hero()); hero.x = 1024; hero.y = 2400; var commandBase = game.addChild(new CommandBase()); commandBase.x = 1024; commandBase.y = 200; var aliens = []; var bullets = []; var commandBaseHits = 0; // New variable to keep track of the number of times the command base has been shot // Function to handle movement function handleMove(x, y, obj) { hero.x = x; hero.y = y; } // Function to handle shooting function shoot() { var bullet = new Bullet(); bullet.x = hero.x; bullet.y = hero.y; bullets.push(bullet); game.addChild(bullet); } // Function to spawn aliens function spawnAlien() { var alien = new Alien(); alien.x = Math.random() * 2048; alien.y = 0; aliens.push(alien); game.addChild(alien); } // Game update loop game.update = function () { // Update bullets for (var i = bullets.length - 1; i >= 0; i--) { var bullet = bullets[i]; bullet.update(); if (bullet.y < 0) { bullet.destroy(); bullets.splice(i, 1); } } // Update aliens for (var j = aliens.length - 1; j >= 0; j--) { var alien = aliens[j]; alien.update(); if (alien.y > 2732) { alien.destroy(); aliens.splice(j, 1); } } // Check for collisions for (var k = bullets.length - 1; k >= 0; k--) { var bullet = bullets[k]; for (var l = aliens.length - 1; l >= 0; l--) { var alien = aliens[l]; if (bullet.intersects(alien)) { bullet.destroy(); alien.destroy(); bullets.splice(k, 1); aliens.splice(l, 1); break; } } // Check if bullet hits command base if (bullet.intersects(commandBase)) { bullet.destroy(); bullets.splice(k, 1); commandBaseHits++; // Increment the commandBaseHits variable } } // Check if command base has been shot 25 times if (commandBaseHits >= 25) { LK.showGameOver(); } }; // Event listeners game.move = handleMove; game.down = function (x, y, obj) { shoot(); }; // Spawn aliens at intervals LK.setInterval(spawnAlien, 2000);
===================================================================
--- original.js
+++ change.js
@@ -1,64 +1,64 @@
-/****
+/****
* Classes
-****/
+****/
// Alien class representing enemy characters
var Alien = Container.expand(function () {
- var self = Container.call(this);
- var alienGraphics = self.attachAsset('alien', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 5;
- self.update = function () {
- // Update logic for alien
- };
+ var self = Container.call(this);
+ var alienGraphics = self.attachAsset('alien', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 5;
+ self.update = function () {
+ // Update logic for alien
+ };
});
// Bullet class for projectiles
var Bullet = Container.expand(function () {
- var self = Container.call(this);
- var bulletGraphics = self.attachAsset('bullet', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 15;
- self.update = function () {
- self.y -= self.speed;
- };
+ var self = Container.call(this);
+ var bulletGraphics = self.attachAsset('bullet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 15;
+ self.update = function () {
+ self.y -= self.speed;
+ };
});
// CommandBase class representing the target to destroy
var CommandBase = Container.expand(function () {
- var self = Container.call(this);
- var baseGraphics = self.attachAsset('commandBase', {
- anchorX: 0.5,
- anchorY: 0.5
- });
+ var self = Container.call(this);
+ var baseGraphics = self.attachAsset('commandBase', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Hero class representing the player character
var Hero = Container.expand(function () {
- var self = Container.call(this);
- var heroGraphics = self.attachAsset('hero', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 10;
- self.update = function () {
- // Update logic for hero
- };
+ var self = Container.call(this);
+ var heroGraphics = self.attachAsset('hero', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 10;
+ self.update = function () {
+ // Update logic for hero
+ };
});
-/****
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000 //Init game with black background
+ backgroundColor: 0x000000 //Init game with black background
});
-/****
+/****
* Game Code
-****/
+****/
// Initialize game elements
var hero = game.addChild(new Hero());
hero.x = 1024;
hero.y = 2400;
@@ -66,71 +66,78 @@
commandBase.x = 1024;
commandBase.y = 200;
var aliens = [];
var bullets = [];
+var commandBaseHits = 0; // New variable to keep track of the number of times the command base has been shot
// Function to handle movement
function handleMove(x, y, obj) {
- hero.x = x;
- hero.y = y;
+ hero.x = x;
+ hero.y = y;
}
// Function to handle shooting
function shoot() {
- var bullet = new Bullet();
- bullet.x = hero.x;
- bullet.y = hero.y;
- bullets.push(bullet);
- game.addChild(bullet);
+ var bullet = new Bullet();
+ bullet.x = hero.x;
+ bullet.y = hero.y;
+ bullets.push(bullet);
+ game.addChild(bullet);
}
// Function to spawn aliens
function spawnAlien() {
- var alien = new Alien();
- alien.x = Math.random() * 2048;
- alien.y = 0;
- aliens.push(alien);
- game.addChild(alien);
+ var alien = new Alien();
+ alien.x = Math.random() * 2048;
+ alien.y = 0;
+ aliens.push(alien);
+ game.addChild(alien);
}
// Game update loop
game.update = function () {
- // Update bullets
- for (var i = bullets.length - 1; i >= 0; i--) {
- var bullet = bullets[i];
- bullet.update();
- if (bullet.y < 0) {
- bullet.destroy();
- bullets.splice(i, 1);
- }
- }
- // Update aliens
- for (var j = aliens.length - 1; j >= 0; j--) {
- var alien = aliens[j];
- alien.update();
- if (alien.y > 2732) {
- alien.destroy();
- aliens.splice(j, 1);
- }
- }
- // Check for collisions
- for (var k = bullets.length - 1; k >= 0; k--) {
- var bullet = bullets[k];
- for (var l = aliens.length - 1; l >= 0; l--) {
- var alien = aliens[l];
- if (bullet.intersects(alien)) {
- bullet.destroy();
- alien.destroy();
- bullets.splice(k, 1);
- aliens.splice(l, 1);
- break;
- }
- }
- }
- // Check if hero reaches command base
- if (hero.intersects(commandBase)) {
- LK.showYouWin();
- }
+ // Update bullets
+ for (var i = bullets.length - 1; i >= 0; i--) {
+ var bullet = bullets[i];
+ bullet.update();
+ if (bullet.y < 0) {
+ bullet.destroy();
+ bullets.splice(i, 1);
+ }
+ }
+ // Update aliens
+ for (var j = aliens.length - 1; j >= 0; j--) {
+ var alien = aliens[j];
+ alien.update();
+ if (alien.y > 2732) {
+ alien.destroy();
+ aliens.splice(j, 1);
+ }
+ }
+ // Check for collisions
+ for (var k = bullets.length - 1; k >= 0; k--) {
+ var bullet = bullets[k];
+ for (var l = aliens.length - 1; l >= 0; l--) {
+ var alien = aliens[l];
+ if (bullet.intersects(alien)) {
+ bullet.destroy();
+ alien.destroy();
+ bullets.splice(k, 1);
+ aliens.splice(l, 1);
+ break;
+ }
+ }
+ // Check if bullet hits command base
+ if (bullet.intersects(commandBase)) {
+ bullet.destroy();
+ bullets.splice(k, 1);
+ commandBaseHits++; // Increment the commandBaseHits variable
+ }
+ }
+ // Check if command base has been shot 25 times
+ if (commandBaseHits >= 25) {
+ LK.showGameOver();
+ }
};
// Event listeners
game.move = handleMove;
game.down = function (x, y, obj) {
- shoot();
+ shoot();
};
// Spawn aliens at intervals
LK.setInterval(spawnAlien, 2000);
\ No newline at end of file
a high tech alien command base. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
a weaponazized alien. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
a city that is wartorn and has many explosoins and brocken buildings. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows