... Pick multiple instances based on selected instance?

0 favourites
  • 4 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.
  • Hello there,

    I'm new to Construct 2 and I'm struggling on how to 'pick' multiple instances based on the object instance I've selected with a mouse click.

    What I'm trying to do:

    I have made one Sprite object. On the layout, I've put multiple instances of this Sprite object, positioned next to, above, or below eachother.

    When I select an instance, I would like to pick all instances surrounding the current instance I've selected, and perform an action on them (change their Animation Frame - I know how to figure out this part).

    So selecting an instance, it must affect the instances directly above, below, left and right of the instance that I've selected by a mouse click.

    I was hoping to archieve this by 'picking' the instances using a System condition 'Pick Nth instance', but it won't work...

    Can someone help me out please?

    Cheers!

  • Hey Dirk, this is an example of how to pick other objects of the same type after selecting a single instance. You will still have to modify it to meet your needs but this will get you started.

    https://db.tt/kc0HoToq

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you. I've tried to work with the example, but it isn't completely what I was aiming for...

    I posted a new message, which hopefully pushes me in the direction I was looking for.

  • If the instances are at a standard distance.

    Hack it!

    1. Create a sprite shape that overlaps everything you want selected (sounds like a circle would do), make its opacity 50 for ease of use.

    2. Set it to invisible by default (left side properties panel).

    3. Spawn it at your selected sprites center image point when the sprite is selected.

    4. Do an On-overlapping check to make all adjacent sprites react.

    5. Destroy circle selector when done.

    I use this for my turn based example https://www.scirra.com/forum/viewtopic.php?f=180&t=118081

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