What is the difference between "Else" and this?

0 favourites
  • 10 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported
  • I'm just making a simple pause menu. The events:

    WITHOUT ELSE

    This was my first try... for whatever reason, doesn't worked. So, I tried with an "Else":

    WITH ELSE

    And it works fine '-'

    So... my question is: the two methods isn't the same thing?

    Thanks.

  • Line3 in the first picture is [ELSEIF: Do something], so after that you have "imaginary Line4" with [ELSE: Do nothing].

    Line3 in 2nd picture is [ELSE: Do something].

    In your first picture, Line3 fired because the variable: pause is updated to 1in line2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Line3 in the first picture is [ELSEIF: Do something], so after that you have "imaginary Line4" with [ELSE: Do nothing].

    Line3 in 2nd picture is [ELSE: Do something].

    In your first picture, Line3 fired because the variable: pause is updated to 1in line2.

    I disagree that it's an ELSEIF

    It's basically:

    IF <condition1> THEN <action1> ENDIF

    IF <condition2> THEN <action2> ENDIF

    not

    IF <condition1> THEN <action1>

    ELSEIF <condition2> THEN <action2>

    ENDIF

    In the former BOTH actions can execute (and in fact did; thus the OP's problem).

    In the latter only ONE action can execute.

  • > Line3 in the first picture is [ELSEIF: Do something], so after that you have "imaginary Line4" with [ELSE: Do nothing].

    > Line3 in 2nd picture is [ELSE: Do something].

    >

    > In your first picture, Line3 fired because the variable: pause is updated to 1in line2.

    >

    I disagree that it's an ELSEIF

    It's basically:

    IF <condition1> THEN <action1> ENDIF

    IF <condition2> THEN <action2> ENDIF

    not

    IF <condition1> THEN <action1>

    ELSEIF <condition2> THEN <action2>

    ENDIF

    In the former BOTH actions can execute (and in fact did; thus the OP's problem).

    In the latter only ONE action can execute.

    Oh yeah you're correct! What I have in mind was the else from elseif is referring to the pause=0 in previous line, I knew this but still making mistake. Sorry Zathan

  • Nah it's fine, I knew what you meant, it's just that it might confuse a beginner (not necessarily the OP)

  • Construct 2 runs events from top to bottom. So in your first picture, the last action in line 2 sets pause to 1. It then goes on to the next line and since pause is set to 1 it runs the event. With an Else condition, line 3 cannot run if line 2 runs.

  • Hey codah just because I am OP you don't have to tell everyone. LOL

  • Hey codah just because I am OP you don't have to tell everyone. LOL

    Now I'm confused!

  • codah if you are confused! then you should contact TOM or Ashley through confused.co** LOL

  • hehehe thank you, guys

    Now I get it.. in fact, it's very simple.

    As Drakkith Said, "Construct 2 runs events from top to bottom".

    So, without the else in this case, there is nothing to stop the third line of execute.. it will always execute both lines.

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