31
0
1mo
User prompt
Add ANOTHER enemy jet called the Dogfighter (Shoots bombs in front of it instead of the back)
User prompt
My bombs won't phase the enemy jets!
User prompt
Add a new asset fot the bombers, also make a unique one, don't just buff every jet!
User prompt
Add a new enemy called the Stealth Bomber (Rare but incredibly fast)
User prompt
Add enemy bombers
User prompt
Make powerups
User prompt
Make the enemy encyclopedia open in mobile when you tap twice in 0.3sec
User prompt
Create a encyclopedia of every enemy
User prompt
My bombs don't do damage to enemy ships
User prompt
Enemy bombs don't do damage
User prompt
The defenses don't do damage when i collide
User prompt
Please fix the bug: 'ReferenceError: defenses is not defined' in or related to this line: 'defenses.push(defense);' Line Number: 170
User prompt
Please fix the bug: 'ReferenceError: bullets is not defined' in or related to this line: 'bullets.push(bullet);' Line Number: 77
User prompt
Please fix the bug: 'ReferenceError: Bullet is not defined' in or related to this line: 'var bullet = new Bullet();' Line Number: 58
User prompt
Add enemy ships that shoot at the player
User prompt
Make it activatable using mobile
User prompt
The button won't work
User prompt
Please fix the bug: 'Uncaught TypeError: LK.showLore is not a function' in or related to this line: 'LK.showLore();' Line Number: 54
Initial prompt
Add a lore button
/**** * Classes ****/ // Class for bombs dropped by Viggen var Bomb = Container.expand(function () { var self = Container.call(this); var bombGraphics = self.attachAsset('bomb', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 15; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.destroy(); } }; }); // Class for enemy bullets 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.y += self.speed; if (self.y < 0) { self.destroy(); } }; }); // Class for enemy defenses var Defense = Container.expand(function () { var self = Container.call(this); var defenseGraphics = self.attachAsset('defense', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.y = -100; } }; }); // Class for enemy ships var EnemyShip = Container.expand(function () { var self = Container.call(this); var enemyShipGraphics = self.attachAsset('enemyShip', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.y = -100; } }; self.shoot = function () { var bullet = new Bullet(); bullet.x = self.x; bullet.y = self.y; bullets.push(bullet); game.addChild(bullet); }; }); // Class for the lore button var LoreButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.attachAsset('button', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for LoreButton }; self.down = function (x, y, obj) { // Show lore when button is pressed console.log("Lore: In the midst of the Cold War, a lone Viggen pilot embarks on a daring mission deep into Soviet territory. Outnumbered and outgunned, the pilot must rely on skill and cunning to survive. This is their story."); }; }); //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Class for the player's aircraft var Viggen = Container.expand(function () { var self = Container.call(this); var viggenGraphics = self.attachAsset('viggen', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self.update = function () { // Update logic for Viggen }; self.move = function (x, y, obj) { self.x = x; self.y = y; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize player Viggen var viggen = game.addChild(new Viggen()); viggen.x = 1024; viggen.y = 2400; // Initialize lore button var loreButton = game.addChild(new LoreButton()); loreButton.x = 1800; loreButton.y = 100; // Initialize bullets array var bullets = []; // Initialize defenses array var defenses = []; // Initialize enemy ships var enemyShips = []; for (var i = 0; i < 5; i++) { var enemyShip = new EnemyShip(); enemyShip.x = Math.random() * 2048; enemyShip.y = Math.random() * -1000; enemyShips.push(enemyShip); game.addChild(enemyShip); } // Initialize bombs var bombs = []; // Handle game move events game.move = function (x, y, obj) { var game_position = game.toLocal(obj.global); viggen.move(game_position.x, game_position.y, obj); }; // Handle game update events game.update = function () { // Update enemy ships enemyShips.forEach(function (enemyShip) { enemyShip.update(); if (viggen.intersects(enemyShip)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } // Make enemy ships shoot at the player every 2 seconds if (LK.ticks % 120 === 0) { enemyShip.shoot(); } }); // Check for collision between player's aircraft and enemy defenses defenses.forEach(function (defense) { if (viggen.intersects(defense)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); // Spawn new defenses every 2 seconds if (LK.ticks % 120 === 0) { var defense = new Defense(); defense.x = Math.random() * 2048; defense.y = Math.random() * -1000; defenses.push(defense); game.addChild(defense); } // Update bombs bombs.forEach(function (bomb, index) { bomb.update(); defenses.forEach(function (defense) { if (bomb.intersects(defense)) { defense.destroy(); bomb.destroy(); defenses.splice(defenses.indexOf(defense), 1); bombs.splice(index, 1); } }); }); // Drop bombs if (LK.ticks % 60 === 0) { var bomb = new Bomb(); bomb.x = viggen.x; bomb.y = viggen.y; bombs.push(bomb); game.addChild(bomb); } };
===================================================================
--- original.js
+++ change.js
@@ -153,8 +153,15 @@
if (LK.ticks % 120 === 0) {
enemyShip.shoot();
}
});
+ // Check for collision between player's aircraft and enemy defenses
+ defenses.forEach(function (defense) {
+ if (viggen.intersects(defense)) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ }
+ });
// Spawn new defenses every 2 seconds
if (LK.ticks % 120 === 0) {
var defense = new Defense();
defense.x = Math.random() * 2048;
Pixel art of a Saab Viggen, the Swedish fighter jet.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A anti-air missile. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A Soviet fighter jet, facing down. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
supply crate. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows