User prompt
Fix Bug: 'ReferenceError: Can't find variable: HeroBullet' in this line: 'var bullet = new HeroBullet();' Line Number: 19
User prompt
Power ups make you shoot in a spread
User prompt
Make enimies drop power ups that make you stronger for 1 minute e.g spread shot, laser, bomb
User prompt
Remove the boss system
User prompt
Give all enemies health bars that increase by one every 3 waves
User prompt
Create a separate asset for the boss
User prompt
Add a skip to wave 5 button above the debug menu
User prompt
Move the debug menu up higher
User prompt
Add a debug menu above the joystick
User prompt
Add a bossfight on wave five that shoots a spread of projectiles
User prompt
Fix Bug: 'ReferenceError: Can't find variable: waveTxt' in this line: 'waveTxt.setText('Wave: ' + currentWave);' Line Number: 250
User prompt
Add a wave display
User prompt
Show the wave in the top left
User prompt
Make a boss spawn every 5 waves instead of at 50 score
User prompt
Add a wave system
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self.lives = 3')' in this line: 'self.lives = 3;' Line Number: 65
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self.lives = 3')' in this line: 'self.lives = 3;' Line Number: 65
User prompt
Make a boss that fires in a spread and has 3 lives, but only comes out every time you get 50 points
User prompt
Give the player 5 lives
User prompt
Make the enemies get stronger for every 50 points you get
User prompt
Change the games background to look like mars
User prompt
Make the background look like Earth
User prompt
Add a shoot button on the right of the screen
User prompt
Joystick for movement
Initial prompt
Hyper Shootout
/**** * Classes ****/ // Hero class var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.createAsset('hero', 'Hero character', 0.5, 0.5); self.speed = 5; self.bulletCooldown = 0; self.moveLeft = function () { self.x = Math.max(self.width / 2, self.x - self.speed); }; self.moveRight = function () { self.x = Math.min(2048 - self.width / 2, self.x + self.speed); }; self.shoot = function () { if (self.bulletCooldown <= 0) { var bullet = new HeroBullet(); bullet.x = self.x; bullet.y = self.y - self.height / 2; game.addChild(bullet); bullets.push(bullet); self.bulletCooldown = 20; // Cooldown period before next shot } }; self.update = function () { if (self.bulletCooldown > 0) { self.bulletCooldown--; } var joystickDirection = joystick.getDirection(); if (joystickDirection.x < -10) { self.moveLeft(); } else if (joystickDirection.x > 10) { self.moveRight(); } }; }); // HeroBullet class var HeroBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('heroBullet', 'Hero bullet', 0.5, 1); self.speed = -10; self.move = function () { self.y += self.speed; }; }); // Enemy class var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('enemy', 'Enemy character', 0.5, 0.5); self.speed = 2; self.move = function () { self.y += self.speed; }; }); // EnemyBullet class var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('enemyBullet', 'Enemy bullet', 0.5, 0); self.speed = 5; self.move = function () { self.y += self.speed; }; }); // Joystick class var Joystick = Container.expand(function () { var self = Container.call(this); var joystickGraphics = self.createAsset('joystickBase', 'Joystick base', 0.5, 0.5); var joystickKnob = self.createAsset('joystickKnob', 'Joystick knob', 0.5, 0.5); self.addChild(joystickKnob); self.isDragging = false; self.startPos = { x: 0, y: 0 }; self.currentPos = { x: 0, y: 0 }; self.delta = { x: 0, y: 0 }; self.on('down', function (obj) { self.isDragging = true; self.startPos = obj.event.getLocalPosition(self); }); self.on('move', function (obj) { if (self.isDragging) { self.currentPos = obj.event.getLocalPosition(self); self.delta.x = self.currentPos.x - self.startPos.x; self.delta.y = self.currentPos.y - self.startPos.y; joystickKnob.x = Math.max(-50, Math.min(50, self.delta.x)); joystickKnob.y = Math.max(-50, Math.min(50, self.delta.y)); } }); self.on('up', function (obj) { self.isDragging = false; joystickKnob.x = 0; joystickKnob.y = 0; self.delta.x = 0; self.delta.y = 0; }); self.getDirection = function () { return self.delta; }; }); // ShootButton class var ShootButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.createAsset('shootButton', 'Shoot button', 0.5, 0.5); self.on('down', function () { hero.shoot(); }); }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000, // Init game with black background backgroundImage: 'earthBackground' // Set background image to Earth }); /**** * Game Code ****/ var shootButton = game.addChild(new ShootButton()); shootButton.x = 2048 - 150; // Position from right shootButton.y = 2732 - 150; // Position from bottom var joystick = game.addChild(new Joystick()); joystick.x = 150; // Position from left joystick.y = 2732 - 150; // Position from bottom // Initialize important asset arrays var bullets = []; var enemies = []; var enemyBullets = []; var score = 0; var hero = game.addChild(new Hero()); hero.x = 1024; // Center of the screen hero.y = 2732 - 200; // Near the bottom of the screen // Score display var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Game tick event LK.on('tick', function () { // Update hero hero.update(); // Move and check bullets for (var i = bullets.length - 1; i >= 0; i--) { bullets[i].move(); if (bullets[i].y < -bullets[i].height) { bullets[i].destroy(); bullets.splice(i, 1); } else { // Check for bullet collision with enemies for (var j = enemies.length - 1; j >= 0; j--) { if (bullets[i].intersects(enemies[j])) { enemies[j].destroy(); enemies.splice(j, 1); bullets[i].destroy(); bullets.splice(i, 1); score += 10; scoreTxt.setText(score.toString()); break; } } } } // Move and check enemy bullets for (var k = enemyBullets.length - 1; k >= 0; k--) { enemyBullets[k].move(); if (enemyBullets[k].y > 2732 + enemyBullets[k].height) { enemyBullets[k].destroy(); enemyBullets.splice(k, 1); } else if (enemyBullets[k].intersects(hero)) { // Game over condition LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } // Move enemies and potentially shoot for (var l = enemies.length - 1; l >= 0; l--) { enemies[l].move(); if (Math.random() < 0.01) { // Random chance to shoot var enemyBullet = new EnemyBullet(); enemyBullet.x = enemies[l].x; enemyBullet.y = enemies[l].y + enemies[l].height / 2; game.addChild(enemyBullet); enemyBullets.push(enemyBullet); } } // Spawn enemies if (LK.ticks % 120 == 0) { // Every 2 seconds var newEnemy = new Enemy(); newEnemy.x = Math.random() * (2048 - newEnemy.width) + newEnemy.width / 2; newEnemy.y = -newEnemy.height / 2; enemies.push(newEnemy); game.addChild(newEnemy); } });
===================================================================
--- original.js
+++ change.js
@@ -117,9 +117,11 @@
/****
* Initialize Game
****/
var game = new LK.Game({
- backgroundColor: 0x000000 // Init game with black background
+ backgroundColor: 0x000000,
+ // Init game with black background
+ backgroundImage: 'earthBackground' // Set background image to Earth
});
/****
* Game Code
A laser. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A laser bullet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A plus sign. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A mechanical wasp. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A turret. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.