Picking/filtering instance issue(s)

0 favourites
  • 10 posts
  • Hey there,

    I got a few issues with filtering instances. I joined two .capx files to show what I'm trying to do.

    In the first case, I'm trying to create an object (blue) to another object's (red) position after a short loading animation. Of course, I want to create blue over only one instance of red, not on every instances of red...but it doesn't work (see .capx).

    The second case is a sort of cheat codes system in which you enter the name of any object in a family into the editBox, followed by "=0". Every object in the family has got its name stored in an instance variable (family instance variable of course), and I ask the editBox to compare which name was entered, followed by "=0" as it's part of the cheat code, and then I want that very object to become invisible when you press the button to send the cheat code. Doesn't quite work either... (see .capx)

    Any idea? Or is what I'm trying to do even possible with the way Construct 2 is designed?

    Thanks in advance.

  • Your events are backwards in CreateObject...

    And you need to explicitly pick the matching objects in the other.

  • CreateObject : So the events have to be in that order, ok... Why that actually?

    PickingByVariable : Nice! I should have thought of that! Thanks a lot!

  • Yours:

    Event1 asks: are any loading sprites overlapping Red -> answer, yes (all of them do - each 'loading' overlaps each Red))

    Event2 triggers when you click on a Red. The actions are: set 'loading' to Visible (but that is all of them, you have not picked the one that is overlapping the Clicked Red, you've by default picked all 'loading'.)

    Mine:

    Event 1: pick the Red that is clicked -> that is the single clicked one.

    Event 2: pick the 'loading' that overlaps the one Red. Action: set that one picked 'loading' to Visible, etc.

    Triggers occur outside of the C2 script/loop, so in general you want these at the top level, and then refine from there.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, I understand better. As I thought, triggers like mouse clicks seem to be "higher priority" conditions.

    Still I thought that sub-events inherited conditions - and the according filtering/picking - from the main event.

    Thanks a lot anyway.

  • They do, but there was no filtering from the main event.

  • Ok, I've played with the CreateObject example again, and I'm running into another issue. Now instead of different instances of the same object (red), I got a few objects from the same family, and my conditions imply checking which one is clicked and if a loading-object overlaps it (as before), but they also check what are the state of its instance variables. I don't know if that's an issue with the multi-filtering, but it's not working once again (see .capx).

    Hopefully you or anybody else can help, and if so thanks in advance.

  • You are still Creating Blue at red.x/y. Needs to be Family1.x/y

  • Yeah, of course... Thanks for pointing it out. Now it works.

    But for some weird reason it doesn't work in an identical situation in an actual game I'm trying to develop. I created the example .capx cause I didn't want to have to post my actual game in here. Can I P.M. you?

  • Yes, that's fine.

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