thombruce / verse

🚀 A universe in progress
Other
8 stars 0 forks source link

Game Over screen (or Player death handling) #59

Closed thombruce closed 10 months ago

thombruce commented 10 months ago

With the introduction of enemy AI in PR #58 the player ship can take damage and will despawn if it runs out of health. This causes several systems to panic:

Anything essentially that is querying for information about a .single() player entity.

These could be changed to .iter() or could be wrapped in conditionals (better) and this would seem to resolve the issue, but...

Well, for one, it sort of still makes sense to show the present location; currently this is determined relative to the player - we should see if this can be maintained such that the location persists after the player is killed.

Enemies should just use a conditional, and will eventually have other behaviours introduced that they perform in the absence of knowledge of a player.

The speedometer... can either be hidden or it could flash "ERROR" or "DEAD" or something.

All of that should be done to establish the sort of patterns we want to have in place for the future. That should be done first.

THEN... we make all of those changed redundant (for now) by introducing a "GAME OVER" pause state. The system changes are immaterial for the time being; but do them first so that we aren't just introducing the game over screen as a band aid - it might be removed or altered later, so that the world goes on even after the player dies (i.e. the GO screen is an active state rather than a paused one and you can see enemies salvaging remains and leaving, etc.). Because the universe does go on. You aren't the centre of it.

thombruce commented 10 months ago

Death handling is now done, making the Game Over screen less of an urgent necessity.

The game no longer crashes on player death.

However, we should still handle the event of the player's death with a game over screen and allow the player to navigate back to the main menu.

thombruce commented 10 months ago

Should be easy enough to simply respond to the player's destruction by moving to a GameState::GameOver in a next_state parameter.

The GameOver state could initially just continue to the StartMenu state. When our UI systems are more complete (see #34 #88 #32 ) we should be able to show game stats...

We currently don't record any such stats. Consider adding an issue for that (player kills, XP gained, money earned, time survived, etc.)