How do I make a check system

0 favourites
  • 5 posts
From the Asset Store
Custom animated Health Bar - check youtube video to make it yourself
  • Hello guys! I am working on a game and I have some problems creating something like a check system.

    Here is an example:

    In this example I have one problem. It only takes the second branch(McChicken) of global variables or the Else. And if I add more branches it always work on the last one

    and the Else. I need somehow to make the system check wich of them is true . For example now if I do all the conditions on the "Big Tower" it goes to Else even thou all the variables are ok.

    In conclusion: I want to make the game check what branch of variables is true and act in concordance with that.

    If someone can help(PLEASE). Thank you and have a nice day!

  • You can have several Else conditions:

    A=1  ....
    B=1
    
    Else   ....
    C=1
    D=1
    
    Else ....
    [/code:1ym1hzxh]
    
    I should note that this kind of programming is not very efficient. If you have lots of events like this or add more variables, your code will soon become very difficult to manage. You should probably choose another way to store all these values, maybe a dictionary, or an array. You can store recipes  as strings of keys: (BigTowerRecipe="burger,piper,maioneza") and use tokenat, tokencount to parse them and loop through the dictionary to check if ingredients are available.
  • dop2000 Thank you for the quick reply but I dont think I undersand what I need to do . Maybe if you can explain in other words.

    Thank you again!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • See this example:

    The system will check event 1. If it's true, other checks will not be performed.

    If 1 is false, then event 2 will be checked.

    If 2 if false too, then event 3 will be executed.

  • dop2000 Thank you verry much bro! It works perfectly

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