Expression for several triggers

0 favourites
  • 7 posts
From the Asset Store
Game Triggers is as versatile as a Swiss army knife, and will be a great resource for any type of game you're creating.
  • I have an event that should react to 3 different anims of the sprite, doesn't matter which of those is playing.

    Is there a way to make this short with expressions?

    something like:

    -when X sprite is playing anim ("1","2","3"), makes this stuff happen.

    The ( ) should represent "any of the anims in here".

  • anyone?

    at least to know if this is possible or not and to avoid having 3 events where I could have just 1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you can use the "or" block.

    make the three event, select them , right click : make "or" block.

  • hmm yes, I know the OR. I've been trying it but sometimes brings many problems and makes the code a little harder to read.

    Is it possible to make what I said in the first post? If not then it's ok. just want to know that...

  • | is a logical OR operator

    put it between the animationnames and it might work.

  • Something like TokenAt?

    https://www.scirra.com/manual/126/system-expressions

    (under the Text section)

  • well, the thing about OR blocks is that sometimes I have to use more "or" stuff.

    for example I have 3 different animations that I use as triggers, that could be used in an OR block. but then, in some cases, I need more triggers like if it's mirrored or not. So that would need some kind of another OR block. That's why I needed this alternate way.

    What I finished doing was adding a variable that activates whenever any of those anims are playing in an OR block.

    about the tokenat, sadly I really didn't understand a single thing about it:

    ---------

    tokenat(src, index, separator)

    Return the Nth token from src, splitting the string by separator. For example, tokenat("apples|oranges|bananas", 1, "|") returns oranges.

    ----------

    it's like chinese for me. Why would it return oranges? i you want it to return oranges just write oranges. anyway, can't understand it.

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