User prompt
remove one of the "Blast through the Cosmos"
User prompt
why is there no title on menu page?
User prompt
why are there 2 "Blast through the Cosmos" titles
User prompt
move "hard" button down
User prompt
move "easy" button up
User prompt
move "easy" button up
User prompt
move "hard" button down
User prompt
move "hard" button down
User prompt
move "hard" button down
User prompt
move "easy" button on menu page up
User prompt
space out the easy medium and hard buttons on the menu page
User prompt
make 3 seperate pages for "easy" "medium" and "hard" difficulties that you will access from the buttons on the menu page
User prompt
Fix Bug: 'Uncaught ReferenceError: MenuPage is not defined' in or related to this line: 'var menuPage = game.addChild(new MenuPage());' Line Number: 500
User prompt
make 3 seperate pages for "easy" "medium" and "hard" difficulties
User prompt
for medium, make bullet counter start at 3
User prompt
make bullet counter start at 5
User prompt
in easy, the bullets still show 3 then move up to 4 when it the starting number should be 5
User prompt
change asset name "purpleBullet" to just "Bullet"
User prompt
Fix Bug: 'ReferenceError: bulletPacks is not defined' in or related to this line: 'for (var k = bulletPacks.length - 1; k >= 0; k--) {' Line Number: 445
User prompt
fix any and all flaws in the code
User prompt
call purple bullets counter: "Bullets"
User prompt
display the amount of purplebullet the hero has left in bullet counter
User prompt
the hero can shoot purplebullet until counter = 0
User prompt
purplebullet counter should not go into negative numbers
User prompt
purplebullet should not go to minus numbers
===================================================================
--- original.js
+++ change.js
@@ -348,9 +348,8 @@
// Initialize the MenuPage
var difficulty = 'easy';
var heroBullets = [];
var bulletCountTxt; // Declare bulletCountTxt in the global scope
-var bulletCountTxt; // Declare bulletCountTxt in the global scope
function initializeGame() {
// Initialize important asset arrays
var enemies = [];
// Create character
@@ -418,38 +417,45 @@
// Move and check bullets
for (var i = heroBullets.length - 1; i >= 0; i--) {
var bullet = heroBullets[i];
bullet.move();
- // Check for bullet collision with enemies and bullet packs
+ // Check for bullet collision with enemies
for (var j = enemies.length - 1; j >= 0; j--) {
if (bullet.intersects(enemies[j])) {
- if (enemies[j] instanceof BulletPack) {
- // If the enemy is a bullet pack
- // Increment character's bullet limit by 5
- hero.bulletLimit += 5;
- } else {
- // If the enemy is an actual enemy
- // Update score
- var newScore = LK.getScore() + 1;
- LK.setScore(newScore);
- scoreTxt.setText('Score: ' + newScore);
- var highScore = Math.max(newScore, Number((typeof localStorage !== 'undefined' ? localStorage.getItem('highScore') : '0') || '0'));
- highScoreTxt.setText('High Score: ' + highScore + ' (WIP)');
- if (typeof localStorage !== 'undefined' && newScore > highScore) {
- localStorage.setItem('highScore', newScore.toString());
- }
- // Increment character's bullet limit
- hero.bulletLimit++;
+ // Update score
+ var newScore = LK.getScore() + 1;
+ LK.setScore(newScore);
+ scoreTxt.setText('Score: ' + newScore);
+ var highScore = Math.max(newScore, Number((typeof localStorage !== 'undefined' ? localStorage.getItem('highScore') : '0') || '0'));
+ highScoreTxt.setText('High Score: ' + highScore + ' (WIP)');
+ if (typeof localStorage !== 'undefined' && newScore > highScore) {
+ localStorage.setItem('highScore', newScore.toString());
}
+ // Increment character's bullet limit
+ hero.bulletLimit++;
bulletCountTxt.setText('Bullets: ' + hero.bulletLimit); // Update bullet count display
- // Destroy enemy/bullet pack and bullet
+ // Destroy enemy and bullet
enemies[j].destroy();
enemies.splice(j, 1);
bullet.destroy();
heroBullets.splice(i, 1);
break;
}
}
+ // Check for bullet collision with bullet packs
+ for (var k = bulletPacks.length - 1; k >= 0; k--) {
+ if (bullet.intersects(bulletPacks[k])) {
+ // Increment character's bullet limit by 5
+ hero.bulletLimit += 5;
+ bulletCountTxt.setText('Bullets: ' + hero.bulletLimit); // Update bullet count display
+ // Destroy bullet pack and bullet
+ bulletPacks[k].destroy();
+ bulletPacks.splice(k, 1);
+ bullet.destroy();
+ heroBullets.splice(i, 1);
+ break;
+ }
+ }
// Remove off-screen bullets and end the game if it's the last one
if (bullet.y < 0) {
bullet.destroy();
heroBullets.splice(i, 1);
@@ -483,9 +489,9 @@
// Spawn a bullet pack every 600 ticks
var bulletPack = new BulletPack();
bulletPack.x = Math.random() * (game.width - bulletPack.width) + bulletPack.width / 2;
bulletPack.y - bulletPack.height;
- enemies.push(bulletPack); // Add bullet pack to enemies array for collision detection
+ bulletPacks.push(bulletPack); // Add bullet pack to bulletPacks array for collision detection
game.addChild(bulletPack);
}
});
}
android. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
letter X png. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
space background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
galaxy background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
galaxy background. High quality
space background.. High contrast