How do I save completed levels ?

0 favourites
  • 14 posts
From the Asset Store
Match the similar cards with each other and free all animals!
  • Hi,

    First of all, sorry for my english.

    I worked for more than two months on a mobile game and I had completely forgotten the save option. And it's been several days I'm trying to solve my problem. I would like at the end of each level, the next level is unlocked.

    I do not know at all how to do it (WebStorage? Array? Dictionnary?). I already watch this tutorial: /watch?v=JJWWw9UMIs0 , but all my levels are a different image and it's doesn't work.

    So how to make the end of each level I unlock the next one. I just want to unlock the next level, and save the progression on the phone. (There is no scoring system)

    (PS: it's a mobile game.)

    Thank you !

  • Hi,

    i had nearly the same problem.

    Here is how i did it:

    On Level finished event:

    ("freigeschaltet" is a german word for unlocked)

    im using a splash screen thats only showed when the app is started, on this layout i use

    and finally on the level select layout i did this:

    "locked" is a boolean varibale

    p.s. please ignore the FGL part, i dont know why i included it in the screenshot

    hope this helps!

    if you have any questions fell free to ask

  • Thank you !!

    I'll try and I'll let you know !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use an array to save your level info (for example 5*1*1 array for 5 levels you can save at each cell of the array a number you see proper(to me, 0 for locked, 1 for unlocked,2 for completed) then you need to save that array to webstorage by saving it as json file. don't worry, I think its easy and I'm nearly 17 years old. for more on how to that check this question I answered before :

    or ask for further help.

  • Hi thank you for your answers !

    I began with the method of fldr and I have some problems. (I certainly forgot a part).

    Here is what I've done :

    My Level Select Event Sheet: To launch every level, I have a specific button, the manipulation is then different. Here is how I made (for the event 32, i made an error, it's Play2 -> set locked to false) :

    [attachment=2:u69l59fp][/attachment:u69l59fp]

    I used for each "playbutton" sprite two instance variables. The boolean variable "unlocked" and the number variable "cur_lvl". (I put "false" for the first playbutton because the level is unlocked at the beginning). I add too on my first level two global variable (cur_level = 0 and cur_unlocked = 0 )

    On the splash screen, I made as you :

    [attachment=1:u69l59fp][/attachment:u69l59fp]

    And on the level, I made this :

    [attachment=0:u69l59fp][/attachment:u69l59fp]

    When my guy is overlapping the finish flag, go to layout "missions" (level select), and put the boolean variable of playbutton2 (level 2) to false.

    Where is the problem because it doesn't work. Thanks for your help

  • And I think it would be a good idea that daoudsami develop his method because I don't understand very well what you were saying with the arrays system

  • Nobody ?!

  • i will have a look at it tomorrow! its bed time here now

  • Ok, i slept enough now to tackle this

    what seems to be the problem?

    from what i see event 173 should be a subevent of 174 and the stuff that happens in 174 should go in subevent 175 under 173 (if you want to unlock the next level when the player finishes currentlevel and current level is the last unlocked level)

    i think i could help you better if you gave me access to the capx, if you dont want me or someone to see the rest of the game, just exclude that parts and put them back in when the problem is solved

  • I created a project to train me a few days ago, maybe you could take a look and make your method.

    That would be fantastic!

    Here is the project test : [attachment=0:3ce8w3ow][/attachment:3ce8w3ow]

  • fldr, have you achieved what you wanted to do on my file? The only thing who's missing is that part of my game

  • I'll explain what he was meant by using arrays, .

    Arrays store data in an orderly fashion, and you can call and insert data wherever you want. Arrays always start from 0, so the first spot for data is 0. To apply this to how you want to save data, you need to make an Array object. This is handy because you can store your level data in the order of levels, making it easy to select data and add it to an overall scoring list, for example. We'll call it array_name for ease of example, . On the Array properties window you'll see a Width, Height and Depth. Width is the total amount of levels you want minus 1 (since it starts at 0, so 13 levels is 12 in the array), and it also represents X, whereas the Height and Depth represent Y and Z respectively. Once made, in an overall Event sheet (one you include on each local Event sheet for each layout) you need to click the following then read on:

    System -> Set at X - NOTE: this is found under the Array section

    Arrays can hold up to three parts of data in one section, for example 'array = [0,01,02], [1,11,12]'. Each has a X, Y, Z number, but you can use only the X, or the X and Y... totally up to what you need to store, but for what you want you just need X, so you use the above Event code for Set at X. For the X value, put the level number. For the value, put the score variable from that local Event sheet. Let's say the score variable is user_score and represents 16. You should now have the following Event code once you hit the Done button:

    array_name -> Set value at 0 to user_score

    The above score of user_score (16) is now set to be array_name[0] in terms of positioning. If you want to grab it from the array to have on the screen to check the score, all you have to do is have an element of your choice set the value to array_name.At(0) (0 is the X, if you had three, you'd need 0, 0, 0 or whatever positions you're wanting to grab) and it will retrieve it. That will retrieve the score which is 16 in this example.

    Hope this helps!

  • First of all, a big thank you for your answer inquiesco, but as "Arrays" and "WebStorage" are completely new elements for me, It's always difficult to realize the saving. I really wanted to know if there was ways for example, if you could modify the file which I put in download because I understand your explanations, but I don't arrive to execute them.

    Thank you very much.

  • Hi, has anybody succeeded in changing my file? Please, this is the final stretch for my game.

    Thank you !

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