[SOLVED]Problem on level selection screen

0 favourites
  • 5 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • Hello everybody,

    I made a mobile game for android with 2 of my friends.

    Here's the link of the game ;

    http://play.google.com/store/apps/detai ... es.TrapTap

    But the problem is we want to save the game on each checkpoint. Actually not exactly "saving" the game. What we want is; for example if the player reaches level 3 and exits the game/shuts down the app and then opens it again we want the player can choose a level between level 1 to 3. I tried to make it with the help of Local Storage but it didn't work.

    here's the event sheet of level 3

    and here's the event sheet of level selection screen

    What am i doing wrong ? Or is there any other way to do it ?

    I hope i'm clear enough with the problem <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • So, what exactly does the LevelCtr (global) value store? Does it store the amount of levels you have already played? Or the number of the level from which you quit the game last time?

    I can see that you use the LocalStorage object correctly, I think the problem you are having is caused by the use of the variable. If you could tell us more about your LevelCtr variable, me might be able to solve your problem. :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for your respond

    It stores or what i wanted to do is make it store the max level you've reached. Like if you played the game till level 6 and then go back to main menu and choose level 3 the value of LevelCtr is 6

    I can also upload everywhere i used LevelCtr variable in 2 hours if you want to take a look

  • So, if I understand you correctly, you don't need to change LevelCtr value when the level you choose is lower than the maximum level you reached right?

    I would say that you need to get the LevelCtr from LocalStorage as soon as you start the game. That's probably the one and only time in your game where you should get the value from the LocalStorage, since the global variable "LevelCtr" isn't dependant on the LocalStorage Key.

    You just need to check the LocalStorage Key when you start the game.

    At the beginning of every level, you should check whether the current level's number is higher than the current LevelCtr and if that is the case, save the level's number as the LocalStorage "LevelCtr_Key".

    Lastly, when the user quits the game, the current "LevelCtr" should be saved to the LocalStorage, in case, the "LevelCtr" variable has increased since the last change of the "LevelCtr_Key".

    This should work, in theory.

    Your images look like you don't have many events, so I'd be happy if you could provide me with a .capx so that I can refer to the event sheet context too. Thanks. :)

  • Thank you so much i solved the problem with help of you. And you also helped me to fully understand the whole Local Storage and Level Selection thing.

    Btw the capx file is around 25 mb so solving the problem with no need to upload the capx file is another great thing

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