Windows How do i make a system that detects whether the game has been started up already or not?

L

Lion

Guest
For Example: In Deltarune you are greated with a black screen and white text, when you exit the game you come back to that, however, if you have saved the game as kris, when you start deltarune it brings up the story and the save screen.
 

samspade

Member
For Example: In Deltarune you are greated with a black screen and white text, when you exit the game you come back to that, however, if you have saved the game as kris, when you start deltarune it brings up the story and the save screen.
When you say game, I assume you mean the 'gameplay' part of the game not the application itself? The simplest way is to do the following steps:
  • in earliest run code set a variable such as game_started = false
  • after this variable is set to false, check for a save file and load the value of game_started from that file, if the file exists
  • when you start the game, set game_started = true and save the value
Look up saving games on YouTube for examples of how to save things. For something like this, it is probably easiest to just use an ini file for now until you need something more complicated.
 
L

Lion

Guest
When you say game, I assume you mean the 'gameplay' part of the game not the application itself? The simplest way is to do the following steps:
  • in earliest run code set a variable such as game_started = false
  • after this variable is set to false, check for a save file and load the value of game_started from that file, if the file exists
  • when you start the game, set game_started = true and save the value
Look up saving games on YouTube for examples of how to save things. For something like this, it is probably easiest to just use an ini file for now until you need something more complicated.
Does that mean when the game starts i have to make it load a .sav file or .ini file?
 

samspade

Member
Does that mean when the game starts i have to make it load a .sav file or .ini file?
It depends on whether I understood your original question, but if you're asking how can I keep information after the game application has been closed and use it the next time the game application is opened, then yes, the only way to do that is save the information somewhere and then load it.
 
Top