Load/Save

  • Hello fellow constructors!

    Im building a economy game, got mechanics pretty much polished, only need to add graphics.

    Now i faced a problem, and i hope you guys can help me out.

    I need to implement auto save, so when you close the game (by closing it or clicking exit button/object).

    But as the game saves, it has to "run in background", because it is bond to time (every x seconds corn field produces x amount of corn, so when you open the game after ex. 12h, your field produced 12x60x amount of corn.

    First i want to do it in local storage, but final game has to load/save data on server, because on local save, you can just fast forward time on your PC/Phone.

    Any suggestions?

    Thanks,

    Bill

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Option 1 (recommended)

    Every 10 seconds > LocalStorage > Set Item "VarName" value of "VarValue"

    On Start of Layout > LocalStorage > Check Item Exists "VarName"

    Item Exists "VarName" > Set variable "InGameVarName" to LocalStorage.ItemValue

    Item Missing "VarName" > Set variable "InGameVarName" to "DefaultValue"

    Option 2 (not recommended)

    Every 10 Seconds > Save Game

    On Start of Layout > Load Game

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