What's a good way to do and/or within the same event?

  • As everyone who's tried it knows, events can't take and/or conditions within the same block. I thought a good way to circumvent this might be to create a local variable that I set to '1' whenever the 'A and B' event comes true and then further down set the main event block up like this...

    | C = 1 | Do stuff...

    - or -

    D = 1

    - or -

    LocalVar = 1

    ... but it doesn't work. LocalVar gets set to 1 when I want it to be, but the next event block doesn't seem to catch it. How do you all handle this kind of situation?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I use subevents to simulate and/or.

  • Yeah, I do that sometimes myself. But in this case I have a whole laundry-list of stuff I want to happen if either A, B, C is true *or* D and E are both true. I don't see a way around that unless I do the event twice, which means heaps of excess code. Maybe I'm just too tired right now...

  • Are you familiar with functions? Use a function for your action, and have two events call the same function.

    -------------+ ----------------------+
    A is True    | Call Function
    [ul]
    	[li]Or -       |[/li]
    [/ul]B is True    |
    [ul]
    	[li]Or -       |[/li]
    [/ul]C is True    |
    -------------+
    
    -------------+ ----------------------+
    D is True    | Call Function
    E is True    |
    -------------+
    
    -------------+ ----------------------+
    On Function  | Actions ect...
    [/code:2ykf7st7]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)