How do I filter one object type into two sets of instances?

0 favourites
  • 4 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Ok so perhaps the subject didn't quite fully explain what I'm trying to do here.

    Basically, I have no problem filtering one object type down to some specific instances and then filtering another object type in the same event, and then performing an action relating only to those two sets of instances. eg:

    If object type 'block' has x position greater than 100, and if object type 'block2' has x position less than 100, THEN change 'block' sprite to 'sprite 2' and change 'block2' sprite to 'sprite 2'.

    In this case the action will only trigger if both conditions are true, and when it does trigger it will ONLY affect the instances of 'block' and 'block2' which were filtered by the conditions.

    My problem is trying to get scenarios like the following to work:

    If object type 'block' is overlapping a point 'block x, block y - 10', then check to see if 'block' has it's 'clearabove' instance variable set to 'true'. If it does then set 'block's instance variable 'clearabove' to 'true'.

    As you can see my problem is that unlike in the first case, where the two instances I wish to compare and filter are of different object types (and thus would not confuse Construct 2's object filtering system), in this case I wish to retrieve the value of an instance variable relating only to instances of 'block' which meet certain conditions (which I have highlighted as 'block') and then I wish to manipulate ONLY the instances of 'block' which meet separate conditions (which I have highlighted here as 'block'.

    I can't find any way to do this without Construct just treating all 'block's as one and the same and filtering them twice (once to see if they overlap the point, and another to see if their 'clearabove' instance variable is true), when really I want two separate filterings to occur. Kind of like filtering 'all people in the room' into 'girls' and 'boys', and then using the results of tests made on the girls to determine the actions that will be taken against the boys; as opposed to filtering 'all people in the room' into 'girls' and then filtering all of those into 'boys', resulting in no instances being selected at all.

    Does anybody know how I can go about doing this? It's been driving me up the wall!

  • Just store that fact that the 'clearabove' flag has been set (local variable), then rather than trying to further pick below that point, you need to move back up a level and pick the non-'clearabove' blocks and then set the 'clearabove' flag.


    Pick overlaps

    ->Pick with 'clearabove'

    -->Set temp = true

    ->If temp=true

    -->Pick not 'clearabove'



  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks blackhornet, I'll give this a go. But what do you mean by 'temp'?

  • A temporary local variable.

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