Home > other >  How to make a while restoring the function of a life
How to make a while restoring the function of a life

Time:09-19

As most of the game on the market, every 10 minutes to add a life, playing a game is minus one, after reaching limit is not increased, close the game back into the game after a while, so this period of time of life, how to do?

CodePudding user response:

The timer function
Consumption after start the time up to 10 minutes after the request to the server to generate a new
If offline
Offline server to save a status including blood volume and record the time
Online reading from the server to the client to judge or directly determine the server need to generate a few
If the number is greater than the upper limit is equal to him

CodePudding user response:

You said the game needs to have a server program
If you do is single, so to come, is open timing detection, once every 1 second test. The test current system time and the last time difference value of the critical incident is up to 10 minutes
If it is, on the restore and then reset the key time. Understand?

CodePudding user response:

reference 1st floor qq_41063643 response:

the timer functionConsumption after start the time up to 10 minutes after the request to the server to generate a new
If offline
Offline server to save a status including blood volume and record the time
Online reading from the server to the client to judge or directly determine the server need to generate a few
If the number is greater than the upper limit is equal to his

Thank you have done, but I have another question this is how to return a responsibility?

CodePudding user response:

refer to the second floor legendcyqkt response:
you said the game needs to have a server program
If you do is single, so to come, is open timing detection, once every 1 second test. The test current system time and the last time difference value of the critical incident is up to 10 minutes
If it is, on the restore and then reset the key time. Understand?

Thank you, I got it, but now it is a new problem, such as above, this is how to return a responsibility

CodePudding user response:

http://www.manew.com/thread-95708-1-1.html
  • Related