Object Picking

This forum is currently in read-only mode.
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello. I'm trying to wrap my head around Construct's picking system. I have to wrestle with it a lot, especially when working with pairs of objects or testing objects against the same types of objects.

    I'm using a single object type for the bounding boxes(BB) of all my game entities. Some bounding boxes are from static, immovable game objects and the rest will collide and push off of each other. These properties are stored in private variables.

    So there are two possibilities in a collision:

    • If a moveable BB collides with a static BB, then the moveable one will push itself out.
    • If a moveable BB collides with another moveable BB, then they will both push each other a little bit every tick.

    Here's how I first imagined I would structure my events:

    For every paired entity, pick its BB.

    If it collides with another BB.

    If second BB is moveable

    > Have both BB's push each other in opposite directions.

    If second BB is static

    > Have the moveable BB completely push itself out of the static BB

    My first confusion with this is in the first condition statement. If I pick only the BBs that are paired with an entity , then how does it know to test them against other BBs on the layout (since the only BB that should be picked at this moment is the one that is paired with the entity)? This actually does what I want despite not knowing why.

    The second confusion comes at either of the sub events when you have to test the colliding objects against each other. Since they are the same object type, how do you tell them apart?

    I'm guessing there's a construct-like way to solve this that I'm just not getting.

    Also, is there anyway to store a hard reference to instances? I realize I end up doing a lot of needless searches.

    Edit: And one more thing: How do you access behavior actions from python?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For your first problem, the usual method is to add the BB objects into two different families. That will allow you to pick two differing instances by family. Say you're using green and red family names:

    For each paired entity, pick it's green

    If green overlaps red

    If red is moveable

    >> Have green and red push each other in opposite directions

    > If red is static

    >> Have the green completely push itself out of red

    ... it's assuming that green is moveable ... also, the 'for each' should be literal, to be clear. There is a condition for that.

    As for the other two questions, I've not used these ideas, but these two threads may help a bit:

    .

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