Windows How do I Make my Game run Code When Not Running?

O

OGDE01

Guest
I'm creating game where you can hatch eggs. Some eggs will take about 8 hours to hatch. I don't think anyone would like to play a game for 8 hours straight just to hatch an egg! I tried using the current_second variable to set the time to the future, but it I don't know how to set to a future time and use that input later. Does anyone know how to do this?
 
M

MatthewL019

Guest
Easy.

This will involve creating game saves, such as .INI files. Make yourself familiar with doing this if you haven't already - here's a helpful tutorial:

When you first begin the hatching progress, take down the current_hour and store it in a variable (let's say 'hatch_begin') When the game is about to be closed (or when the player saves), store variable hatch_begin in a .INI file. When the user loads the game up again, read hatch_begin from the .INI file, calculate how much time has past since (use current_hour again), and decide if it has hatched or not. Hopefully this helped!
 

Cpaz

Member
Easy.

This will involve creating game saves, such as .INI files. Make yourself familiar with doing this if you haven't already - here's a helpful tutorial:

When you first begin the hatching progress, take down the current_hour and store it in a variable (let's say 'hatch_begin') When the game is about to be closed (or when the player saves), store variable hatch_begin in a .INI file. When the user loads the game up again, read hatch_begin from the .INI file, calculate how much time has past since (use current_hour again), and decide if it has hatched or not. Hopefully this helped!
Yep.
Though what the OP is asking isn't technically possible (running "game code" when the program isn't running), you can use saved data to basically fill in the blanks of what happened between then and now.
 
Top