"Or" expression

  • Hello everyone! I'm actually doing a tileset system for my game and i need some help about something.

    "Tiles" on collision with player

    "Tiles" compare frame: 12 | 15 //This is the two tiles i use

    Events:

    Set "Tile" solid disabled

    But the :

    "Tiles" compare frame: 12 | 15 //This is the two tiles i use

    Not working, i want a thing like 12 or 15 or xx or ...

    It's working fine with just a number.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you even use that or symbol in construct? I didn't know that.

    Why don't you just make two conditions and set the block as an "or" block. Right click the block with the conditions and if one condition in that event is true then it will do the actions.

    If you want to do a "and" and "or" block, you have to make a sub event block for that unfortunately, but I'm certain it will work.

  • You can use the '|' symbol, but not everywhere. For your frame check, the standard event mechanism works. Picking allows you to evaluate an expression with symbols. Both are shown here:

    <img src="http://blackhornettechnologies.com/Construct2Stuff/ORsample.jpg" border="0">

    ORsample

  • blackhornet, was not aware of this, thanks

  • Actually I did figure out a third way, which I was wanting to be my second way, but the system is a bit convoluted.

    <img src="http://blackhornettechnologies.com/Construct2Stuff/ORsample_plus.jpg" border="0">

    You should be able to check an expression without the condition ? result_if_true : result_if_false, but C2 requires this extra step.

    ORsample_plus

  • Note that 'or' in expressions is a logical OR, so "12 or 15" (alternative syntax "12 | 15") equals 1, because both operands are nonzero.

  • That's can be really long if we have +100sprites to add with the "or" block, i knew it was existing, but i needed to find a fastest way

  • You're doing something wrong if you need 100 OR comparisons. Maybe post what you've got so far for review.

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