Thursday, October 6, 2022
HomeGame Developmentadd a timer that retains working even the sport is closed -...

add a timer that retains working even the sport is closed – Cocos Creator


I need to create an power system in my sport the place the participant can have 5 power and can lose 1 every degree performed … and i would like the power to regenerate 1 power each 20m.
how am i able to accomplish that ? i would like the timer to maintain working although the sport is closed.
Ty upfront




1 Like

I feel it’s higher to simply use a timestamp with the power object, whenever you launch the sport you possibly can evaluate the final power timestamp with the precise time and calculate the delta, for each 20 minutes you possibly can add yet another power again. When the sport launches it retains your timer logic



3 Likes

@leRenard
The one downside right here. is that The participant would possibly cheat by altering the time.
the one answer is to attach the sport to a time server that’s not changable by the participant
(The participant is unable to alter time)

@nutrino
You would possibly do one thing like Shadow combat 2
In order for you your sport to works offline
When the the participant’s gadget linked the web calculate the timestamp from the server.
In any other case from the gadget’s timer



2 Likes

Ty each very a lot ! I’ll strive to try this.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments