HELP!!!

  • I am currently working on a platform game where the player is required to pick up a series of keys to unlock the door before being allowed to the next level.

    As there are multiple keys to collect, how would I be able to check whether all the keys have been collected?

    I first though I could use a Boolean variable to check, but I'm not sure how to do it, or whether that is the correct way of doing it.

    Any help would be greatly appreciated.

  • RG110

    Add a variable and set it to the total amount of keys, then decrease it every time you pick one up.

  • spongehammer

    I did think of that as an idea, but as I am going to have multiple levels with different amounts of keys, is there not a more dynamic way of doing it?

  • Put this in the layout event sheet:

    System: On start of layout -> System: Set TotalKeys to Keys.Count

    It'll automatically set the total keys the player needs to collect to the number of keys.

  • GeometriX

    Thank you so much, this is exactly what I was looking for...

    Thank you very much sir.

  • GeometriX

    currently when the player has picked up all of the keys and stands over the door object, it enables them to go to the next level.

    Currently I am doing the following: Player: Is overlapping door & Keys = 0 -> System: Go to Layout 2

    Is there a more dynamic way of doing this.. I want the logic for all the levels to be kept to one event sheet if possible.

  • System: Go to Layout int(layoutName)+1

    This assumes your layouts are named 1, 2, 3 etc.

    You could also have another variable called 'LevelNumber', increment it by 1 at start of layout and when going to next level use:

    System: Go to Layout LevelNumber+1

  • vee41

    Currently when I try and use any of those actions there is nowhere I can enter anything, Just a dropdown menu....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • vee41

    Currently when I try and use any of those actions there is nowhere I can enter anything, Just a dropdown menu....

    Use Go to Layout(by name) - action. It's in the system events.

  • vee41

    Thanks for your help, that's exactly what I wanted!!

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