Will It Ever End?!


Last week I was tasked with implementing an end state to our game. The objective was for the player to collect some batteries to reach the end game state, allowing the player to continuously loop through the game. Initially when collecting the batteries the game loop wouldn’t end at all. This was obviously a problem because the player had no way of progressing or ending the game.

The issue was in the battery item itself. I decided to use the item as a sort of band-aid solution until our inventory system is implemented. I had set an integer to be incremented and used as a switch to exit the game. I realized that incrementing it while it was getting destroyed did absolutely nothing, because the variable would never reach the if statement used to end the game. Instead, I simply set the game to exit when a battery was destroyed to at least get some sort of exit loop working.

Get ASTRO SHIPPING CO.