Spaceshooter game BUGS!

Please help!! I’m making a space shooter game and encountered some bugs.

There are 3 kinds of power-up in this game. 2 of these are powerups that improve the rate of fire on projectiles that can stack with each other:

Projectile powerup 1 = Doublefire
Projectile powerup 2 = Tripplefire

The 3rd one is a laser that can be used when pressing A:

Laser

BUG 1: When 3 projectile powerups are on the screen at the same time, once I get to stack the 2 different projectile powerups, the remaining 3rd powerup on the screen will not be destroyed in contact with mysprite.

BUG 2: When I get a laser powerup, an indicator regarding the laser will show up on the side of the screen. When I press A, mysprite will shoot laser and the indicator will disappear. However, if I have a laser power up and then got another laser powerup, once I press A, the indicator will not disappear.

Also, I need suggestions about how can I make the enemy shoot projectiles in the direction where my sprite is.

Thanks!

4 Likes

Oh wow! This is a beautiful game!

I’m heading out for the evening, but I definitely will take a look at this over the weekend.

You have a lot of code, so it will take some time to get through all of it.

When I run into bugs in a complex program like this, I try to disable everything that does not apply to the bug. So, if you are debugging the powerups, disable the code that creates enemies so that you can focus your attention just on the code for the powerups. (Disable blocks by dragging them out of, say, the forever block where they are contained. Disabled blocks are shown in lighter colors. It looks like you already know how to do that.)

Good luck! Great game!

2 Likes

Thank you so much for your response.

I really need help because I’m now stuck with these bugs aheheh :sweat_smile:

I will try to disable the blocks that are not related to these bugs.

Anyways, I actually made some visual improvements to the game while I’m thinking of a solution::

3 Likes

Absolutely amazing game @Camaro, well done!

1 Like

OK; I squashed your bugs. :slight_smile:

For this one, you need to change your on overlap event handlers for PowerUP, PowerUp2, and Shield.

image

Because you might have multiple sprites of a given type on your screen, always use the sprite and otherSprite variables in your on overlap event handlers.

This one is a bit more difficult, but it’s a related problem. You may have multiple Bomb indicators on your screen, and you need to be able to handle that. I changed your on button A pressed event handler to look like this:

Each time you touch a Shield sprite, an indicator is added to the screen. If you touch multiple Shields, then you have multiple indicators. When you press the A button, the first indicator (or Bomb) is destroyed, leaving the other on the screen to be used later by the player.

The only other bug that I found was in your end game routine. Remove the call to startLevel.

image

If you want to see how I went about debugging your program, feel free to take a look here:

Basically, I moved all of the code in your forever loops into functions, and then I only called the ones that I needed. (So, I removed all bosses and minions to focus on the power ups). I also moved the code where power ups are spawned into their own functions so that I could call that code whenever I wanted.

This is a really fun game! Nice work!

2 Likes

Thank you so much! :sob: :grinning_face_with_smiling_eyes:

You even made all these efforts and it really makes me happy

Here’s an update to the game and finally no more bugs :grinning_face_with_smiling_eyes:

2 Likes