How do I Create Levels for a Mobile Game!

0 favourites
  • 8 posts
From the Asset Store
a ready made template of Mobile Advert, Google Play and Mobile IAP Plugin,
  • Hi everyone,

    I am trying to create a game with many levels but I also want my game save the progress of the player.

    For example the player reaches level 66 but when the game is closed and reopened in the mobile phone the game again starts from level1 and all other levels are locked back!

    So I am planning to make a World Map and the other levels are locked and they are opened as the player finishes the previous levels and so forth but at the same time the progress is always saved.

    How can I manage to save the data in my game?? I looked some of the Database tools (arrays, webstorage etc.) but couldn't figure out.

    I would appreciate the help.

    Kind Regards

  • Why don't use System save/load state?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If your using global variables, it would be reset every time you close your app or browser.

    Use the webstorage plugin.

    I assume you have a global variable for 'levels'. In this example, ill call it: Global_level

    In your event sheet, input a condition on WHEN you want it to save the 'level'.

    For example, On your level complete trigger (which is your condition), your action would be: Set local/session value (under WebStorage actions).

    Here you would set: WebStorage.LocalValue("level")

    Set local value "level" to (Global_level) (This would be your global variable but obviously you named it differently)

    Now, when you are playing your game, and you complete a level, it would be stored locally in your device or pc. (Unless you clear cache).

    Now, remember to get the local value from Webstorage "level" everytime you start your game so that it remembers which level you left off from.

    So in your event sheet: On start of layout: set (Global_level ) to the Webstorage's local value. (Type in Webstorage and find LocalValue, It'll will look something like this: Webstorage.LocalValue("level"). Make sure to type level in between "" indicating the what string value to retrieve.

    Hope that helps,

    Rich

  • Richard521 Thank You So Much for the advice I will definetly try it.

    Naji Thank you I will also try it. Does it work in a way that everytime the level ends I create a save state at the end of each level? So when the game is open it will reload where it was?

  • You can control save/load states anytime you want by the system's event and actions. Simply you can save a game triggered by an event and load it by an event!

  • Naji Cool That looks pretty useful )

  • your welcome, you can also add infinite game slots by just adding few events and a global variable

  • Cool!! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":-)" title="Smile" /> Thank You So Much For The Help! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

    Below Are 2 of my games I created with Construct2 If you would like to check out <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />)

    Jumpy Shark

    bit.ly/160kRL5

    Altered Soccer

    bit.ly/12nsQPY

    As you might see they are limited my first try outs! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /> So I want to make more complicated Games at least with many levels engagin games <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

    Thank You once again.

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