How do I pick instances without families?

0 favourites
  • 3 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • With multiple instances of an object, how would I set up conditions to pick two that for example are overlapping (or the same angle), if I didn't have access to families?

    ObjectA is overlapping ObjectA seems to always run, I guess as each instance is always overlapping itself.

  • I think after an overlap condition like that you use pick nth instance to pick one or the other. An instance won't overlap itself, you can test this by setting it's opacity to 50 or something to visualize it.

    Another approach I've used is to have a seperate detector object, which you can set to the position of one object and then detect the other ones.

    For comparing angles and such you can pick one instance, save it's iid to a variable then pick all and do the comparison from there.

    Or you can just follow a pattern like this:

    | for "a" from 0 to sprite.count-1                                    |
    | for "b" from loopindex+1 to sprite.count-1                          |
    | compare sprite(loopindex("a")).angle = sprite(loopindex("b")).angle |
       | pick sprite instance loopindex("a")                              |
       | pick sprite instance loopindex("b")                              |
       +------------------------------------------------------------------+[/code:x9i4nh5x]Or some simplification to that effect.
    There are other ways too, and basically it involves picking one, and saving values to variables then picking the other.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks R0J0, saving relevant information to local variables and repicking worked well.

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