Is there an easier way to handle this?

This forum is currently in read-only mode.
  • https://projects.gscept.com/attachments/download/451/SpaceKeyEvents.JPG

    It's a huge mess of nested if statements at the moment. It works... but I wonder if there is some sort of easier way to accomplish the same thing? It basically opens doors when switches are thrown in the correct order, or when clues are activated in the right order.

    Any ideas? Advice? or just click all the - signs again and hope for the best?

  • Merge conditions for same actions

    Like:

    + Condition A > Action 1

    + Condition B > Action 1

    + Condition NOT C > Action 1

    can be merged into

    + Condition A OR B OR NOT C > Action 1

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's a huge mess of nested if statements at the moment. It works... but I wonder if there is some sort of easier way to accomplish the same thing? It basically opens doors when switches are thrown in the correct order, or when clues are activated in the right order.

    Any ideas? Advice? or just click all the - signs again and hope for the best?

    That's what loops are for

    In order to use loops effectively you need to redesign your work. Naming conventions and assigning of values should be used in a way that makes it easier to loop them. For example the first switch:

    Rearrange the assigning of the values so that you constantly substract/add in a row if switchnum is 1-4 and constantly add/substract from 5-6. Name your animations in a "loopable" way (like AnimA, AnimB, ... to name a very easy and not very informative one). When the preparing is done you could do something like this:

    Reducing 16 events down to 5.

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