"Else" VS Invert

0 favourites
  • 5 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • I really am a new in Construct 2.

    I am confused using "Else" vs Inverting condition. What is the difference between those 2?

    thx

  • The event with Else will only run if the previous event did not run. Very useful for toggles.

    Invert is usually for picking like usual.

    For example, if you had is overlapping, and inverted is not overlapping, both these will run and the relevant actions applied to the objects that are or are not overlapping.

    If you had overlapping, then else, the else event would only run if nothing was overlapping. If anything was overlapping, the else event would not run.

  • Yeah as oosyrag said

    Else is more open. It means do any of this if the comparison is not true.

    If sprite is overlapping background- do foo

    Else- do some other foo

    Inverted means the opposite of the comparison.

    inverted sprite is overlapping background- do foo = sprite is not overlapping background- do foo

    They are about the same, but else gives you the option to do something if a comparison is true as well, but you have to keep in mind inverted may not always work as expected.

    Additionally else will not do any picking, so you would have to add extra conditions for that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Alright. I understood for now. Thank you oosyrag and newt for the information

  • Else is also great to add in a lot of situations because once it finds a true statement it will skip over the else.

    Example

    var Color = blue

    If color = blue

    --set color = red

    if color != blue

    --set color = purple

    The color would end up being purple. The first statement would change to red making the second statement true when reached. If that isn't what was intended you can add the else:

    If color = blue

    --set color = red

    Else

    --set color = purple

    This would result in the color being red. The first statement was true so the Else statement was skipped.

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