Triggers not triggering / reseting correctly

0 favourites
  • 10 posts
  • Ok, I have a family of objects that I'm trying to have activate/deactivate triggers. It works for individual object but if I try to have multiple objects (with different ID's set by instance variables) it starts acting up. What am I doing wrong here:

    FAM_OBJECTS is overlapping TRIGGERSPRITE ->



    Trigger once

    -> OBJECT set boolean true


    FAM_OBJECTS is not overlapping TRIGGERSPRITE



    For each OBJECT

    Trigger once

    -> OBJECT set boolean false

    It seems to trigger/deactivate correctly for one object but with multiple objects overlapping triggers with different ID's problems arise. I can't figure out how to fix this so any help is much appreciated!:)

  • The picking is a bit off there. The logic you need will be :

    For each objects

    Objects is overlapping TriggerSprite

    Objects.ID = TriggerSprite.ID

    Set bool true


    Set bool false

    Obviously the family and trigger sprite are interchangeable depending on if you really have to check against the trigger sprite's variable and not the family.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you very much for your help!

    I tried the solution proposed but unfortunately I still haven't been able to make it work. Here's an example capx (sorry about the couple of disabled extra conditions as I was trying different things to solve this!): ... oblem.capx

    Both triggers activate correctly but don't deactivate. I suspect I'm using "trigger once" wrong here, but if I remove it then no visible changes happen at all (infinite loop?).

    I've been trying to get this to work correctly for several hours now and it's getting tiresome so if anyone has time to take a look at the new capx and have ideas on how to fix it I'd be very grateful <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • it's the Else you're using wrong, it should all be in one event. Have the ForEach at the top of the event, then in 2 subevents (press S) have the first section and the else section. ... .capx?dl=0

  • Thank you so much again !

    This is a definite improvement, but I noticed one more problem with the other object, as demonstrated in this capx: ... ed_V2.capx

    I gave both objects platform behavior movement for demonstration/testing purposes. If the blue box overlaps with the trigger without the pink overlapping a trigger, nothing happens. However if pink alone overlaps trigger it activates, and if both overlap both triggers activate.

  • Working like a light switch ... .capx?dl=0

    Working as something standing on a scale. ... .capx?dl=0

  • Oh I see what you want it to do now, I was using family instance variables. Yeah you don't need a for each, just if family is overlapping switch and switch ID matches block ID then set to true.

  • 99Instances2Go &

    Awesome, you guys are the best!

    This was very helpful and now it seems to work exactly as should, I can finally move back onto tackling other mechanics in my game. Thanks again!

  • See, the thing is. A condition has a logic part (if true it runs its actions) and a picking part (it makes a list of selected objects).

    If you want to set a Boolean based on the logic (true/false) you best use an 'else'. Else means 'if the previous condition did not run (hence it is false), run this condition.

    If you want to set a Boolean to a list of picked objects (true), and set the opposite the unpicked objects (false), then the the second condition will be the first inverse. But, that second condition cant be a sub of the first because those objects are not picked by the first one.

    Now, those two 'rules' combined. Often it means (for the logic based else) that the top conditions are the picking conditions. Then a sub with that logic condition, then attached to that sub the logic else. Or in general:

    Pick object A

    Pick object B

    ______Logic condition





    You want set a boolean if a object is onscreen, if none of that object is onscreen you want to set the boolean to false.

    (object) Is onscreen

    _____________________set boolean true


    _____________________set boolan false

    Or. You want to set a boolean of all instances of an object to true when they are on screen, and to those that are offscreen you want to set the boolean to false.

    (object) Is onscreen

    _____________________(object) set boolean true

    (object) Is (NOT) onscreen <----- no sub and INVERSED

    _____________________(object) set boolean false

  • 99Instances2Go Thank you for the explanation, I really appreciate it! I think I have a better understanding on how picking and booleans work now!

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