User prompt
Change special item spawn rate to every 10 secinds
User prompt
Spawn special items every 30 seconds
User prompt
Special item generate randomly and float through screen. When touched by plane they make the hero plane bullets move faster for 4 seconds
User prompt
Enemy 1 and enemy 2 assets
User prompt
review code to fix enemy spawn problem
User prompt
enemies shoot enemy bullet
User prompt
modify the spawnEnemy function in the Game class. The enemy's initial y position should be set to 0.
User prompt
enemies come from top of screen
User prompt
Expand health bar horizontally by 50 pixels
User prompt
Fix Bug: 'TypeError: self.self is undefined' in this line: 'self.self.enemyBullets.forEach(function (bullet) {' Line Number: 116
User prompt
Fix Bug: 'TypeError: self.parent.self is undefined' in this line: 'self.parent.self.enemyBullets.push(bullet);' Line Number: 34
User prompt
Fix Bug: 'ReferenceError: enemyBullets is not defined' in this line: 'enemyBullets.forEach(function (bullet) {' Line Number: 116
User prompt
Fix Bug: 'ReferenceError: enemyBullets is not defined' in this line: 'enemyBullets.forEach(function (bullet) {' Line Number: 116
User prompt
Fix Bug: 'ReferenceError: enemyBullets is not defined' in this line: 'enemyBullets.push(bullet);' Line Number: 34
User prompt
Fix Bug: 'ReferenceError: enemyBullets is not defined' in this line: 'enemyBullets.push(bullet);' Line Number: 34
User prompt
enemy spawn starts at start of game
User prompt
make health bar red
User prompt
expand health bar vertically by 50 pixels
User prompt
Place health bar on bottom of screen
User prompt
Move health bar lower
User prompt
Make health bar taller
User prompt
Change the health indicator to be a health bar
User prompt
give player 3 health and display it on screen
User prompt
create asset named "Enemy Plane"
User prompt
Make an asset for enemies
var HealthDisplay = Container.expand(function () { var self = Container.call(this); var healthBar = self.createAsset('healthBar', 'Health Bar', 0, 1); healthBar.tint = 0xFF0000; healthBar.width = 2048; healthBar.height = 100; self.addChild(healthBar); self.updateHealth = function (health) { healthBar.width = health / 3 * 2048; }; }); var Hero = Container.expand(function () { var self = Container.call(this); self.health = 3; var heroGraphics = self.createAsset('hero', 'Hero Plane', .5, .5); self.speed = 5; self.move = function () {}; self.fire = function () {}; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('enemy', 'Enemy Plane', .5, .5); self.speed = -3; self.move = function () { self.y += self.speed; }; self.fire = function () { var bullet = new EnemyBullet(); bullet.x = self.x; bullet.y = self.y; bullet.move = function () { bullet.y += bullet.speed; }; self.parent.self.enemyBullets.push(bullet); self.parent.addChild(bullet); }; }); var HeroBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet', .5, .5); self.speed = 10; self.move = function () { self.y -= self.speed; }; }); var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('enemyBullet', 'Enemy Bullet', .5, .5); self.speed = -7; self.move = function () { self.y += self.speed; }; }); var Game = Container.expand(function () { var self = Container.call(this); var bg = self.createAsset('background', 'Background Image', 0, 0); bg.width = 2048; bg.height = 2732; var bg2 = self.createAsset('background', 'Background Image', 0, 0); bg2.width = 2048; bg2.height = 2732; bg2.y = -2732; var hero = self.addChild(new Hero()); var healthDisplay = new HealthDisplay(); LK.gui.topLeft.addChild(healthDisplay); var enemies = []; var heroBullets = []; self.enemyBullets = []; hero.x = 2048 / 2; hero.y = 2732 - 200; var spawnEnemy = function () { var enemy = new Enemy(); enemy.x = Math.random() * 2048; enemy.y = 0; enemies.push(enemy); self.addChild(enemy); }; spawnEnemy(); var spawnHeroBullet = function () { var bullet = new HeroBullet(); bullet.x = hero.x; bullet.y = hero.y; bullet.move = function () { bullet.y -= bullet.speed; }; heroBullets.push(bullet); self.addChild(bullet); }; var spawnEnemyBullet = function () {}; var checkCollision = function () {}; var gameOver = function () {}; LK.on('tick', function () { bg.y += 2; bg2.y += 2; if (bg.y >= 2732) bg.y = -2732; if (bg2.y >= 2732) bg2.y = -2732; hero.move(); healthDisplay.updateHealth(hero.health); enemies.forEach(function (enemy, index) { enemy.move(); if (LK.ticks % 60 === 0) { enemy.fire(); } if (enemy.y > 2732) { enemy.destroy(); enemies.splice(index, 1); } }); heroBullets.forEach(function (bullet, index) { bullet.move(); if (bullet.y < 0) { bullet.destroy(); heroBullets.splice(index, 1); } }); self.enemyBullets.forEach(function (bullet) { bullet.move(); }); checkCollision(); }); LK.on('tick', function () { if (LK.ticks % 30 === 0) { spawnHeroBullet(); } }); var dragHero = null; stage.on('down', function (obj) { dragHero = hero; }); stage.on('move', function (obj) { if (dragHero) { var pos = obj.event.getLocalPosition(self); dragHero.x = pos.x; dragHero.y = pos.y; } }); stage.on('up', function (obj) { dragHero = null; }); });
===================================================================
--- original.js
+++ change.js
@@ -112,9 +112,9 @@
bullet.destroy();
heroBullets.splice(index, 1);
}
});
- enemyBullets.forEach(function (bullet) {
+ self.enemyBullets.forEach(function (bullet) {
bullet.move();
});
checkCollision();
});
Futuristic fighter plane, chrono trigger, top down view, behind Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Special item shooting game pixel art, shiny Single Game Texture. In-Game asset. 2d. Blank background.
Top down shooter, alien space enemy craft, retro pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Bright yellow blast pixel art shooter game Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
65604d9e9017209915d71b35: Top down shooter, alien space enemy craft, retro pixel art, red flying space alien, giant eye ball Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
65604d9e9017209915d71b35: Top down shooter, alien space craft enemy craft, retro pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art bullet blue and white shining orb of energy retro Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art top down aerial view barren desert, sand dunes, retro shooter Single Game Texture. In-Game asset. 2d. Blank background. Low contrast. No shadows.
hit point heart pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art explosion, retro Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.