New Teacher - describing when to use a sub-event vs a condition?

0 favourites
  • 10 posts
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • I'm working with high school students - 9th -12th grade. I'm wondering what the real distinction is between sub-events and conditions. The line appears a bit grey to me - I can see the condition being that flip is moving, or the idea that a sub-event where flip is moving is occuring. I'm looking for a way to understand this so that I can clearly describe it to students who may struggle with the difference.

    -Theresa Hendrickson

    Minnetonka Schools.

  • How would you describe a logical and?

    The difference between a condition, and sub condition is that the events contained to the top tier only have to obey the rules of the top condition.

    Events placed in with the sub-events have to obey all the conditions like an and.

  • You could do it either way.

    Let's have a condition called "Mood".

    - If Mood = Sad

    -- Create particle effect "Tears"

    - If Mood = Sick

    -- Create particle effect "Boogers"

    You could also do it another way, with 2 buttons that indicate mood.

    - Click on "Sad Button"

    -- Create particle effect "Tears"

    See how that works?

  • If I were to describe it to students, I'd say something like this.

    In my game, spacebar shoots a gun. But there are different gun types.

    Because I only want 1 event to listen for the spacebar being pressed, I'm then going to use sub-events to check what weapon is active.

    so, something like this...

    key pressed - space:

    if gunType == 0

    shoot pistol

    else if gunType == 1

    shoot shotgun

    else

    shoot rocket

  • Something like this?

    CONDITION
    
    If I am moving..
    
    	SUB CONDITIONS
    		..and i am in car..
    			..do this..
    		..and i am on a bicycle
    			..do this..
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The question makes it sound like you've mixed up the concept of event blocks and conditions.

    Event blocks contain a list of conditions and a list of actions. An event block can be a sub-event to another event block.

    Conditions test whether things are true or false, and the actions run if all the conditions were met. Conditions can be in both events and sub-events, the distinction doesn't matter.

    However an important point about sub-events is that they run after the actions of the parent event block - i.e. they are only checked if all the parent event's conditions were true.

  • That makes sense. Thanks so much.

  • To clarify my original question - paraphrasing one of the responses above -

    space bar is pushed << event

    gun is coconut gun << sub event or condition?? or doesn't it matter?

  • Better as sub-events as none is triggered until space bar is actually pressed. If you have everything together then each block of code is checked every tick, may not make any difference, but if it is in a more demanding game it could affect performance.

    Also it is better organized, you would have to have SPACE pressed+type of gun condition for each gun, it is simpler to have SPACE pressed only once than add types of guns as sub-events

  • I kind of like to think of these as a flow diagram.

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