User prompt
Fix Bug: 'ReferenceError: Can't find variable: HeroBullet' in this line: 'var bullet = new HeroBullet();' Line Number: 84
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: Can't find variable: addChild' in this line: 'var hero = addChild(new Hero());' Line Number: 66
Code edit (1 edits merged)
Please save this source code
User prompt
Add powerups to the game that makes the ship shoot two bullets side by side for 5 seconds
User prompt
Make ship shoot twice as fast
User prompt
Add powerups to the game that makes the ship shoot two bullets side by side for 5 seconds.
User prompt
make ship shoot twice as fast
User prompt
Add powerups to the game that makes the ship shoot two bullets side by side for 5 seconds.
User prompt
make ship shoot twice as fast
User prompt
add powerups to the game that make the ship shoot two bullets side by side for 5 secs
User prompt
The hero ship should not be stuck to the mouse, but follow the mouse around with a limited speed. The ship should always move towards the mouse.
User prompt
Make enemies shoot at the hero
User prompt
Spawn waves of enemies, only spawn the next wave when the current wave of enemies have all been killed.
User prompt
Make enemies stop moving down at a random position in the top 3rd of the screen
User prompt
Progress the development of the game.
User prompt
Integrate a scrollable star field, behind everything, providing an illusion of ongoing forward movement. Faster moving stars should be more visible.
User prompt
stars
User prompt
Progress the development of the game.
User prompt
The powerups never seem to show up, please fix this?
User prompt
Add powerups to the game that makes the ship shoot two bullets side by side for 5 secs
Initial prompt
make ship shoot twice as fast
===================================================================
--- original.js
+++ change.js
@@ -1,20 +1,4 @@
-var PowerUp = Container.expand(function () {
- var self = Container.call(this);
- var powerUpGraphics = LK.getAsset('powerUp', 'PowerUp Graphics', 0.5, 0.5);
- self.addChild(powerUpGraphics);
- self.speed = 3;
- self.move = function () {
- self.y += self.speed;
- if (self.y > 2732) {
- self.destroy();
- }
- };
- self.activate = function (hero) {
- hero.poweredUp = true;
- hero.powerUpTimer = 300;
- };
-});
var HeroBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = LK.getAsset('heroBullet', 'Hero Bullet Graphics', 0.5, 0.5);
self.addChild(bulletGraphics);
@@ -36,10 +20,8 @@
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = LK.getAsset('hero', 'Hero Spaceship', 0.5, 0.5);
self.addChild(heroGraphics);
- self.poweredUp = false;
- self.powerUpTimer = 0;
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = LK.getAsset('enemy', 'Enemy Spaceship', 0.5, 0.5);
@@ -107,24 +89,13 @@
}
allEnemiesKilled = false;
}
function fireHeroBullet() {
- if (hero.poweredUp) {
- var bulletLeft = new HeroBullet();
- var bulletRight = new HeroBullet();
- bulletLeft.x = hero.x - 20;
- bulletRight.x = hero.x + 20;
- bulletLeft.y = bulletRight.y = hero.y - 50;
- heroBullets.push(bulletLeft, bulletRight);
- self.addChild(bulletLeft);
- self.addChild(bulletRight);
- } else {
- var bullet = new HeroBullet();
- bullet.x = hero.x;
- bullet.y = hero.y - 50;
- heroBullets.push(bullet);
- self.addChild(bullet);
- }
+ var bullet = new HeroBullet();
+ bullet.x = hero.x;
+ bullet.y = hero.y - 50;
+ heroBullets.push(bullet);
+ self.addChild(bullet);
}
function fireEnemyBullet(enemy) {
var bullet = new EnemyBullet();
bullet.x = enemy.x;
@@ -212,19 +183,13 @@
checkCollisions();
starField.forEach(function (star) {
star.move();
});
- if (hero.powerUpTimer > 0) {
- hero.powerUpTimer--;
- if (hero.powerUpTimer === 0) {
- hero.poweredUp = false;
- }
- }
if (allEnemiesKilled) {
currentWave++;
spawnWave();
}
- if (LK.ticks % 30 === 0) {
+ if (LK.ticks % 15 === 0) {
fireHeroBullet();
}
enemies.forEach(function (enemy, index) {
if (LK.ticks % 90 === 0) {
Single space torpedo flying upwards Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Single enemy slime bullet flying downwards. Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
single alien enemy spaceship facing down, looking like space alien adopted to living in space. Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.
Hero spaceship facing upwards, with a single cannon in the center. Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.