What is the differnce?

This forum is currently in read-only mode.
  • What is the difference between

    V2:

    http://www.box.net/shared/6ufzkqmor1

    and V3

    http://www.box.net/shared/1e3xhgkcz1

    This type thing is the hardest for me to understand about construct. I have no clue when you want to add a "New sub event" as in V2 or lump them together as in V3

    BTW neither does what I want it to do hence my confusion. See:

    Angle of Motion Question

  • Logic-wise, version three is asking:

    If the user clicks and releases the button AT THE SAME TIME! :O

    Which is impossible.

    The sub-event one is kinda doing the same thing. Sub-events are very useful for compressing code where one or more conditions are common to all of them.

    A good example would be instead of using the following four events:

    + System: Is global variable 'Var' Equal to 1

    + MouseKeyboard: Key Up arrow is down

    -> Sprite: Set 'Direction' to "Up"

    + System: Is global variable 'Var' Equal to 1

    + MouseKeyboard: Key Up arrow is down

    -> Sprite: Set 'Direction' to "Up"

    + System: Is global variable 'Var' Equal to 1

    + MouseKeyboard: Key Left arrow is down

    -> Sprite: Set 'Direction' to "Left"

    + System: Is global variable 'Var' Equal to 1

    + MouseKeyboard: Key Left arrow is down

    -> Sprite: Set 'Direction' to "Right"

    You could use one event with four sub-events like so:

    + System: Is global variable 'Var' Equal to 1

    + MouseKeyboard: Key Up arrow is down

    -> Sprite: Set 'Direction' to "Up"

    + MouseKeyboard: Key Down arrow is down

    -> Sprite: Set 'Direction' to "Down"

    + MouseKeyboard: Key Left arrow is down

    -> Sprite: Set 'Direction' to "Left"

    + MouseKeyboard: Key Left arrow is down

    -> Sprite: Set 'Direction' to "Right"

    I hope that's legible, a subevent triggers when the event its below is true, in this case, if Var equals 1, then it runs the arrow events. There are other handy uses for them too but it gets a little situation specific I find. I'll be happy to try and explain it better if you didn't understand my ramblings.

    In any case, I fixed up your angle of motion cap without using any subevents anyway Go have a look if you haven't already

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So the sub event is only for visual clarity? I was thinking it to be more like If the Event was true then continue with the sub event.

    If that is true we could really use a case statement.

    Oh and thank you for taking the time to explain that Arcticus.

  • I use subevents as example to check if sounds GV is 1 and if it is play sound

    Simple as that

  • So the sub event is only for visual clarity? I was thinking it to be more like If the Event was true then continue with the sub event.

    No, sub-events are not just for visual clarity. Yes, you can use them that way if you want to, but what you were thinking is correct... if the root event is true then the sub-event will run. If the root event is not true, then the sub-event will be skipped.

  • Thanks deadeye, I see that now after doing a test. Which confuses me why my bad program ran both sub events at the same time.

    I have so much to learn about Construct. In a few cases real code is much easier to follow.

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