How to make the levels open when passing?

0 favourites
  • 12 posts
From the Asset Store
Assets for creating mountains and ravines environments
  • There is a level selection menu, say from 1-20, if we pass the first level, then the second one opens and so on. If we finished playing and turned off the game, the progress is saved and the next time you start the game in the levels menu, as many levels as we have passed will be opened.

    Please help me)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • there is no built in system like that everything u see in games published by construct function of game wise is made by construct users, what construct offers is visual scripting ...

    which means it does code work for u and u just use simple math logic and puzzling of behaviors and objects to make stuff..

    so for a level system you need to create a Global Variable... that will never reset that means when u change the layout player dies or whatever happens u never use the system expression "reset global variables" that will revert it back to initial state u have when u export the game.

    so in order to make the level system u have to say in your pseudo code something like this

    is Global Variable "level" = 1

    Left clicked on sprite level 1 = go to layout "level 1"

    for level 2 3 4 5 ...20 u do the same for the menu selection.

    then u need to use the same "level" global variable during the layout, and check if player finished the round lets say he found the key to the next level.

    then in ur code u need to do something like

    player collision with key

    add to "level" 1

    go to layout "menu selection"

    (il add some saving information here also for in case stuff closes suddenly involves local saving)

    now on menu selection

    when it starts u always make the items in menu selection check for level = ???

    if the level value matches their supposed id or level to go to ... then we make their frames change to color gold or next frame after gray frame, if its not equal to item menu selection id u don't have to code nothing just keep the gray frame on frame zero

    now for local saving .. when player hits key or on every 2 3 seconds, u just save the global variable using localsaving plugin i forgot how is called, as "level" and the global variable value that is by inputting as value the name of the global variable so your localsaving event needs to look something like this

    every 3 seconds localsaving save item "level" with value GlobalVariableName - u change that

    so in case a device failure happens he won't lose much progress.

    to load that data.

    on the main menu or logo progress whatever comes before the level selection, u go as follows

    on start of layout localsaving plugin Load item with name "level"

    Condition : if global variable not equal or less than localsaving.lastdata Action set global variable to localsaving.lastdata

    and kinda that is it, for more info on this i think tutorial section has a menu with local storage like i just explained somewhere if its not on the construct.net try scirra.com/tutorials is for C2 but it works for C3 also ( as long as there are no custom plugins used in the .capx files that are not officially supported)

    hope it answers your questions have fun :D

  • there is no built in system like that everything u see in games published by construct function of game wise is made by construct users, what construct offers is visual scripting ...

    Thank you very much. Now my code looks like this, for some reason it does not work.

  • that is because u have to save the item first in localsaving plugin, and to do that u have to go to a game layout and trigger the save level item value to localsaving, once that is done, you can then move to the main screen and trigger the event that you show in your screenshot.

    it looks good the way you set it up. is just it doesn't work, cause ur item doesn't exist in localstorage yet, so your item.get returns NaN and sets value of level to NaN. i presume also the buttons don't play anything not even the level 1?

  • that is because u have to save the item first in localsaving plugin, and to do that u have to go to a game layout and trigger the save level item value to localsaving, once that is done, you can then move to the main screen and trigger the event that you show in your screenshot.

    it looks good the way you set it up. is just it doesn't work, cause ur item doesn't exist in localstorage yet, so your item.get returns NaN and sets value of level to NaN. i presume also the buttons don't play anything not even the level 1?

    There are no buttons working and when you click on 1 you get to the level and so on, with the condition if the animation is set to On. I'll try to figure it out and do as you said) Thank you)

  • Edited:

    here is a file example to make u better understand what i mean, u have done 90% of the work though :D

    localstorage+level selection menu

    at the start of game event on my example, i have a erase storage... u can remove that line action was there for my own saving locals to erase to check some event errors i was getting.

  • Edited:

    here is a file example to make u better understand what i mean, u have done 90% of the work though :D

    localstorage+level selection menu

    at the start of game event on my example, i have a erase storage... u can remove that line action was there for my own saving locals to erase to check some event errors i was getting.

    Thank you so much! Now I will study the file))))

    It is very different from my file. It can be seen, I tried to approach from the wrong side = (

    Here is my file that did not work (

    yadi.sk/d/s6LmVPifM1YqLA

  • yea your file is not doing well.... lol (localsaving mentioning .... ) is just setting a variable but on the start of loading screen after that it just goes from level to level ... and increments the openingvariable but u need to also save it... on the same level change.

    take a look at my example that i sent, and try make sense of it, i tried to comment it and keep it as simple as possible.

    also on levels, when u increment the openinglevel ,set item openinglevel in the localstorage, before u go to the next layout.

    you need to follow, the order of reading, from top to bottom, if you reset before u save, there might be a save done.

    don't worry it's nice to see new people joining the community though, we all been there learning.

  • yea your file is not doing nothing lol xD is just setting a variable but on the start ... yea take a look at my example that i sent, and try make sense of it, i tried to comment it and keep it as simple as possible.

    Yes, many thanks again. I thought it was much easier)) BUT no. Parse your file) Thanks again)

  • redownload the file localstorage+levelselect

    i had a event error on the selecting menu.

    you should also look at the official localstorage example for hiscores

    hiscore localstorage

    just my example is made for levels.

  • redownload the file localstorage+levelselect

    i had a event error on the selecting menu.

    you should also look at the official localstorage example for hiscores, in the similar way is my example made just for levels.

    hiscore localstorage

    This is a great file, I'm trying to figure it out. I want to understand how work with storage is arranged. I hope that I will understand and lay out my file already working)

  • you can redownload once more the file, i commented in detail each event and condition+action

    localstorage + levelmenu v3

    have fun.

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