"Is Equal to Any From List" Condition

0 favourites
  • 7 posts
From the Asset Store
The game will give you a dog that appeared and you must say if he appeared more, less or equal.
  • Hello,

    I've spent a bit of time searching Google and these forums for help with this issue, but haven't had much luck. Hopefully someone on here can help me. I'm having a bit of trouble creating a condition which requires an animation from be equal to any one number from a list.

    Essentially, if the AnimationFrame is equal to any one of these numbers (0, 4, 8, 12, 16, or 20), then the event will occur. However, I can't seem to find the right expression or method for executing something like that. It doesn't seem like 'choose' or 'random' would work, because then the event wouldn't occur in every instance. I need something that would basically look like:

    AnimationFrame = any(0, 4, 8, 12, 16, 20)

    Any help you can offer would be appreciated. Feels like I'm missing something blatantly obvious, here.

  • You need to make an "Or" Block.

    Then it looks like:

    AnimationFrame = 0


    AnimationFrame = 4


    AnimationFrame = 8

    ... and so on.

    Right click the condition, then choose "make OR block".

  • Ah, thanks. I was hoping there was a way around doing that. That's what I've been using for a while, but wanted to see if I could condense it with a couple of expressions. Thanks for your help!

  • Maybe there is an "easier" way for this. But I don't know a better solution, as this is already simple if you dont have hundrets of cases to check.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In your case you could compare (sprite.animationframe % 4) = 0

    (x % 4 will return the rest of the division x/4)

  • Aphrodite is right. % (mod) is a very useful operator I find myself using a lot in C2

  • Aphrodite

    Good to know. I wondered if such an operator existed.

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