How to: problems with level selector.

0 favourites
  • 3 posts
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • Hi guys,

    I'm having some problems here.

    I have a level selector, let's like it's Angry Birds-like (you can't play level 2 unless you have completed level 1), and I'm having some problems here...

    I don't know if I'm doing it correctly or not, but this is the way that came to me.

    In my level selection layout, I have two sprite-buttons, one of the is level one, the other is level two.

    You can play level one (green colour), but level two is disabled (gray).

    I've tried to do it in two ways:

    Having an active variable for each button, so I enable it when it's true.

    Having an external object, which stores local variables, basically the same.

    So, I also have a level one layout, level one eventsheet, and level one HUD eventsheet. The relevant one here is the HUD sheet. There, I count how many enemies are in the level, and if I destroy them, this number decreases, so when it reaches 0, the level ends (level completed).

    When the level ends, I make a recount of the points earned for destroying enemies, and I switch the level 2 active variable from my level selection layout to enabled.

    What happens is that I guess it doesn't really enable it, as my level 2 doesn't turn green as it should.

    Also, my global var "total score" (points which will be used in an in-game shop), goes crazy when I try to add my level earned points to it, as it seems it doesn't stop adding them, and my total score var goes on increasing.

    Could anyone help me with these matters?

    Thanks in advanced, and sorry for the long post.

  • So after struggling with it, I think I found a solution for both problems.

    For the level selection one, I've done it with global variables, and it seems it works correclty now.

    For the total score update, it seems something was going on with my timer, as when I tried to set the score as : totalScore = playerScore + (timeLeft*2);, the "timeLeft*2" seemed to be the one that was giving me the problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hum... I don't know why, but when I try to set an object instance into the layout (Ex:Archer into Level1 Layout), it doesn't appear when I run the game.

    I think I actually deleted the Archer object from my folder, and the replaced it, don't know how.

    All its actions remain there, and it's instantiated well, so I don't know what's happening.

    EDIT:

    Nevermind. Its variables got edited to 0 when it was deleted.

    I guess that's the problem :)

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