Unlock level

0 favourites
  • 6 posts
From the Asset Store
Unlock Levels, Worlds & skin plus add coins by watching ads
  • Hello everyone! I am creating my first game with construct 2 .... I have a small problem! since the game and the fact that I am creating levels, I would ar each level completed, in the game menu appears next Level unlocked ... I hope I explained ... thanks in advance

  • I would suggest that you first make a global variable that remembers what is the highest level number unlocked so far. When the player reaches the end of level 1, do a condition check if the current level is the same as the highest level number unlocked, and if it is, increase that number by one, and return to the level selection layout.

    On the level selection layout, exactly how you to this would depend on what visual style you prefer, but let's assume you want to show screenshots of all the levels in the game, and for those that you've unlocked you can click the screenshot to go to that level.

    Create a sprite object called "LevelSelect" or something, and add the screenshots from the game to the different animation frames of that object. Add an instance variable to the object, called "level" or something, and make as many instances of this object as you have levels. Change the animation frames to give all the levels the correct screenshot, and in each of the sprites, set the level variable to a different level number.

    In the level select screen's event sheet, you now need to add two things to make this work:

    • Condition: LevelSelect > Compare instance variable > level less or equal to HighestLevelUnlocked
    • Action: Go to layout (by name) > "Level " & LevelSelect.level

    That makes all the links to levels clickable - the second step is to make all the locked levels LOOK unlocked. I think you can do that using For Each on the LevelSelect object: On start of layout, check if the level instance variable is greater than HighestLevelUnlocked, and if it is, make LevelSelect spawn another object: A big lock, a semi-transparent black square the same size as the screenshot, or whatever you want to use to make the screenshot look locked.

    Or something like that. Haven't tested this, so it may not be bug-free.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • An obvious bug in my code ... When checking LevelSelect > Compare instance variable > level less or equal to HighestLevelUnlocked, you also have to add a second condition to check if that object is currently being clicked or touched. Sorry.

  • triks are you looking for something like this?

    Webstorage multilevel saving

  • Another inspiration Making an Interactive Treasure Map Tutorial

  • YES Wink ! webstorage ! ok!

    thanks you !

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