Help with projectile-based game

My game is here https://arcade.makecode.com/S11684-46433-22543-72372
It is a sci-fi shooter game but you can only shoot while you are moving. Can anyone help me debug this?

The first change you should make is not having a variable for each alien. It looks like all the aliens are the same so there is no reason to care about them individually. That change removes about 75% of the code.

Use event handlers. Instead of having a forever loop watching for an alien to die handle it in the event handler.

You also have a forever loop watching for the A button to be pressed. Move that code to the A button event handler.

Make those changes first. You may find everything is working. Right now you have so many variables and flags that a bug is unavoidable.

1 Like

The other issue is your forever loop:


The “velocity x” code measures speed and direction
Hence, using just “x” should work
Hope this helps!

1 Like

Thanks a lot, I appreciate it!

1 Like

Thank you for this! I’ll make sure to change this, I appreciate it!

1 Like