Total playtime?

0 favourites
  • 3 posts
From the Asset Store
Cue in the war drums and battle cadences with Total War Game Music Loops!
  • Is it possible to show the total playtime a player has done? Even after saving a game? Like pokemon or somethin.

  • It depends on the type of save game system you're using, whether or not you'd ever want to pause the clock, and if you ever change the timescale.

    The most simple way is to call up wallclocktime, which simply counts the number of real-time seconds the game has been open for. This isn't ideal for some situations, like if you wanted to pause the game in any menus, during cinematics, and so on. It's also not ideal if you're using a custom save system (with WebStorage), as wallclocktime resets every time the game is opened. It will be restored if you use the built-in save game system, though.

    I'd suggest that you use a global variable, and increment it by dt every tick in all situations where you'd want to track the total time played. A neat way to display formatted time is with this expression: int((GameTime/3600)%60)&":"&zeropad(int((GameTime/60)%60),2)&":"&zeropad(int(GameTime%60),2)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • At the end of layout (say your game ends on a "GAMEOVER" type layout... or use your own way" >>> add wallclocktime to LocalStorageThingy.PlayTime

    Then display it in your HUD etc.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)