0 Favourites

[RESOLVED] Unlock corresponding level & menu

  • Hi C2 community,

    I'm a trying to make a sytem which unlock the levels when it's completed. I've look at the level tutorial;


    But it doesn't do exactly what I need :S.


    • In my game, a level can be replayed (to collect stuff).

    In the current tutorial, the value current.level add one no matter which level has been completed. Considering this, if the player completes the same level over again, it unlocks the others!

    • Also, I don?t know how make a button available (MENU)only when the level is unlocked. For now, touching a level button goes to the corresponding layout even if the level isn?t unlock.


    -     A level can only be unlocked once, but the player can replay it as much as he wants.

    -     From the MENU, a level can be loaded only if it's unlocked.

    -     A button ?continue? load the last unlocked level.


    Unlock Levelstutorial


    -     A level can only be unlocked once, but the player can replay it as much as he wants.

    -     From the MENU, a level can be loaded only if it's unlocked.

    -     A button ?continue? load the last unlocked level.

    the first point :

    you want when you click on the button (level1) it will take you to layout for level 1 and if you clicked button for level2 it will take you to layout level2 right??

    if it like this then you just need to change the event number (11) in "event sheet 1" (in the example capx)

    to this :


         condition1:mouse left clicked on button

         condition2:value at levelsbutton.level>0

         action1: system :go to (by name) ---> and write this : "LVL"&levelsbutton this mean it will take you to layouts with names :LVL1,LVL2,LVL3... so name your layout as this..

         action2: set currentlevel to levelsbutton.level

    *so just change action1 and layout names.

    the second point and the 3rd point i didn't understand what you need ? can you explain what you have did and what happened and what you want to happen

  • I don't have time right now to look at your game, but have you checked out my treasure map tutorial? You could use the same technique to create a menu. (Link is below.)

    EDIT: Oops. zsangerous beat me to it, but basically we're taking the same approach.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • kittiewan , your signature is blocked in my country :) can you change tinyurl.com :P

  • - From the MENU, a level can be loaded only if it's unlocked.

    Let's clear this with an example:

    Suppose that my game have 5 levels. When my character collides with the end sprite at the end of a level, it makes the current level state to 'completed' and 'unlock' the next one which becomes available from the 'MENU' layout. (ex: complete LV0 makes LV1 available from the MENU layout).

    The problem is each time the player collides with an end sprite, the value of 'current.level' add 1.

    As an example, if I replay the LV0 5x times, all levels are unlocked in a row, but the player haven't completed the Level_1, 2, 3 and 4!They are supposed to be locked.

    • Complete a level to unlock the next one (becomes unlock from the MENU layout.


    - A button ?continue? load the last unlocked level.

    Let's forget about this one... :)

    Thanks for your help, I'll take a look at the button stuff.

    Just ask again if it's unclear :)

  • I'll take a close look at it to know if it makes what I need and give you feedback on this.

    Thx for helping.

  • hmm could you upload the capx? if you can't show me the event that player collide with gate at least let me know what im doing , do you need the stars system or no??

  • kittiewan , your signature is blocked in my country :) can you change tinyurl.com :P


    I had to use tinyurl because of the character limit in the signature. The links to the tutorials are SO long...

    However, here are the direct links:

    Making an interactive treasure map

    Making a Memory Match Game


    I've try to use the 'Map tutorial' and adapt it to my needs. Well it works the way I want for the unlocking system. Therefore, I've try to implement the 'sprite state' from the level-page tutorial. I also need a collectible star system.

    I've make a new CAPX and added code from the level-page tutorial. So it's there... but not functional.



    Thx for your help, you deserve REP points :)

  • ok , i really don't know why you didn't like my tutorial o.o what is the point that you didn't understand it?? anyway when i saw your capx there are many weird stuffs for example when i win it just open the next level but it doesn't fix the button it doesn't show you got 1 star or 2 and so on ... also you used frames and useless variables like Layout variable. and even worst the unlock levels has names 0.0 so i fixed all of them i wish you like it but please try to read the whole tutorial before you ask even try to see what i'm talking in the tutorial (download my capx)

    ok you can just use this as just 3 levels on it ^^


    i hope you like it , good luck in your game :)

  • First of all, Thank you, it works just fine. For sure, i'll explain the misunderstanding :

    I've never said that I don't like your tutorial? It's just that I've decided to look at the 'treasure map' to see if I was able to use it, then I've try some stuff, deconstruct it and so on... time goes by. It just happen like this, I'm sure your option was viable too, don't take it personally.

    For the weird stuff, some elements were in the tutorial and I haven't figure it all of them. I've just try to make it work... Consider that I'm not a pro coder, what is easy for you to code can be difficult for me. The useless'layout' value refers to the name of layout and was used to go the name layout. From what I've understand from the treasure tutorial.

    For the 'star' stuff, well I know that it wasn't functional... I've said it in my message 'and added code from the level-page tutorial. So it's there... but not functional.' I just want to mix both tutorial because each one has one part that I needed. I've just add the code from 'level-page' for the 'sprite' state and star to be easier and faster for you to code.

    For the level, it will be something like 18 levels and I've managed how to put more ;)

    And YES,I like your tutorial, It's perfect ^^

    PS: Don't worry, I will add your nickname and all people which helped me on the credits. Ashley should add a 'BADGE' for people named on game credits... could be cool!

    THX again.

  • ^^ i didn't take it personally but i want to know the missing things on my tutorial so i can fix it and help the newbie ^^ about adding my name in credits its up to you if you think i deserve it put it ^^ also i found something weird on your capx the array doesn't have height or width or i just mess it up :) also remember the width of the array should be the same or more than the levels on the level page so if you need 18 levels ,change the 10 to 18 on array properties..

    last thing good luck in your game ^^ and keep the good work :)

  • I would like to enumerate the orange squares, eg 1,2,3,4 ... State testing and nothing .. you could tell me how?

    <img src="https://www.scirra.com/images/articles/level1_2.png" border="0" />

  • no one knows? I'll have to open a new post for someone to read it, since it seems that here no.

  • Anyone? :(

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
1,068 148,674
Reflextions's avatar
Unread hot topic
604 153,298
aniketraorane's avatar
Unread hot topic
256 37,723
tutbarao's avatar