How do I make an "OR" action?

0 favourites
  • 6 posts
From the Asset Store
11 loops of RPG, chiptune/8-bit music. Suitable for any pixel art game.
  • Well, I am so new on C2, probably it is not so complex but I could not figure out, how can I make an OR between actions not conditions? So, I have an object with on create condition, then action is that I want it to rotate clockwise OR counter-clockwise. I can't find a place to add OR between two actions after condition.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can't - the actions are mutually exclusive. Actions are a result of the Conditions, and 'OR' is a Condition, so would usually be part of the 'If - Or' Condition Event.

    For this case, it may be better to use 'Else', but we would need to see your Events, or a better description of exactly what you are trying to accomplish.

  • I'm guessing you want to select rotation direction randomly?

    Use choose(0,1) to "flip a coin".

    if choose(0,1)=1 then rotate clockwise

    else rotate counterclockwise

    Or you can use choose() expression in a formula: Rotate (choose(-1,1)*degrees)

  • Thank you for very quick answers!

    Here is the case:

    So, as far as I understood, it is not possible to add an "OR" like in red, but how can I connect A condition to A action and B to B?

    dop2000, thank you but my actual problem is using "OR" not really rotating something, it is just an example. But your explanation is very important, by the way is there a document to see all possible expressions in all formulas?

  • What you probably looking for is Else condition.

    If condition A -> action A

    else -> action B

    You can also use other conditions after Else:

    If condition A -> action A

    else if condition B -> action B

    else if condition C -> action C

    else -> action D

    "Else" can't be used with triggered events like "On created" event on your screenshot.

    Triggered events have a little green arrow and usually start with "On.."

    You can see the list of all expression in the expression editor, there is a semi-transparent window with all objects in your project. If you click System for example, you'll find all system expressions.

  • OK, thank you. I got the point.

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