crystal-bit / space-shooter

Shoot 'em up game, developed for the Hacktoberfest 2019 event with the Crystal Bit community.
GNU General Public License v3.0
41 stars 34 forks source link

Spaceship controls disabled on final life loss #103

Closed Charles-Schleich closed 5 years ago

Charles-Schleich commented 5 years ago

Implemented a lives variable in Spaceship.gd to keep track of the lives of the spaceship (Just mirrors the current_life_count in HUD.gd) I dont particularly like the implementation as the number of lives should be in a single place and referenced from there.

But it solves the problem of being able to move your explosion around the screen.

davcri commented 5 years ago

Hi @Charles-Schleich thanks for your help and interest in Space Shooter!
The code solves the issue so I merged the PR.

However keep in mind that it's better to use a single source of truth for the spaceship lives: instead of creating a local variable inside the spaceship script, it's better to ask the HUD how many lives remain. In this way you don't have to write specific code to keep the local variable updated and you avoid bugs (in this case it's pretty simple, but in other cases it gets more complicated).

However I'll create a separate issue to refactor the code. Thanks again, I hope you had a great Hacktoberfest! 🎉