Enter Game, Switch Level, and Die

To make my first couple of testable levels, I need a clear understanding of how to preserve the game state and how to reset the level when I die and also how many times I wanna die and where I will get reborn, and how I get reborn.

Soft Requirements

So I made a simple list of some soft requirements.

  • Making dying a painless thing
  • Getting reborn at a save spot to be able to try again
  • Seeing the relicts of past battles I fought
  • Picking up the game after a day without losing anything

Hard Requirements

The soft requirements lead to a set of hard requirements. The hard requirements are easier to make happen in code than a fluffy set of soft requirements.

Connect the Rooms
The rooms exit and entrance are connected that way I know where I have to place the player after he left the room through a certain door or exit.

Player Enters a New Game
If I start a new game I need a default entrance point for the player and this is only for the very first room anyway.

  • Drop the player at the rooms default location
  • Load the room in its initial state

Player Switch the Room
In case I die I wanna back the inial state of my ammo and weaponry to have a fair chance to be able to clear this room.

  • Store the state of the current room
  • Remove the current room
  • Keep all collected and not used up ammo and weapons
  • Load the room you switch either the saved or the initial one
  • Drop the player at the connected entrance of the new room
  • Store ammo and weapon state at this point

Player Dies
I must get back the state I had when I entered the room to be able to clear this room else I might run out of ammo over time and the chance to make it through that room goes to zero.

  • Drop the player on his last entrance
  • Remove all items the player collected in the current room
  • Load either the saved room or the initial room
  • Load ammo and weapon state

Player Dies in Not Finished Room
I have one special case, if I enter a new room collect ammo and weapons, go back to old rooms and use up all ammo in those old cleared rooms, I have no chance to make it through the new not yet cleared room. So I need the following rule.

  • If you die in a not yet cleared room reset that room to initial state

First Footage

A short footage about switching levels with the rules from above. Enjoy.

There is still some problems with falling stuff if I left a level. This falling stuff will stop falling if I leave the level and continue falling if I reenter the level.


I get a small commissions for purchases made through the following links, I only have books in this section which I bought myself and which I love. No bullshit.

cli

Software Developer

5 1 vote
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments