"If" doubt

0 favourites
  • 4 posts
  • Hello, i just read a tutorial that made me have a doubt in C2 about "if" basic functions with events and subevents.

    So, all the conditions are triggered by "unseen" if's like this:

    ------------------------

    Condition Var1 = 1

                  actions [Var1 = 0]

    ------------------------

    This can be interpretated with if's. Like this (NOTE inside () are the unseen if's to interpretate this better)

    -----------------------

    (if)

    Condition Var1 = 1

    (then)

                  actions [Var1 = 0]

    ------------------------

    But what about sub-events? It happens like some kind of second "then" right? Below the example of what i mean.

    -----------------------

    (if)

    Condition Var1 = 1

    (then)

                  actions [Var1 = 0]

    (then) *SUB-EVENT STARTT*

    (if)

    Var1 = 0

    (then)

                  actions [Var1 = 1]

    ------------------------

    Am i correct or not? Thanks

  • Yes, your understanding is correct.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is no such thing as a secondary 'then'. An event is an 'if' statement. So a sub-event is an 'if' statement within an 'if' statement. Like this:

    if (Condition1)
    {
      // actions
      Action1();
      Action2();
    
      // sub-events
      if (Condition2)
      {
        Action3();
        Action4();
      }
      if (Condition3)
      {
        Action5();
      }
      
    }
    

    Condition 2 and 3 represent sub-events of the event defined by Condition 1. They occur inside the scope of Condition 1 so they have access to everything defined within Condition 1.

  • Thank you very much.

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