... Pick multiple instances based on selected instance?

Get help using Construct 2

Post » Mon Oct 19, 2015 8:59 pm

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!
B
3
Posts: 4
Reputation: 183

Post » Mon Oct 19, 2015 11:58 pm

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
ImageImage
B
130
S
23
G
7
Posts: 1,078
Reputation: 13,280

Post » Fri Oct 23, 2015 9:06 pm

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.
B
3
Posts: 4
Reputation: 183

Post » Wed Oct 28, 2015 7:11 am

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
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
71
S
19
G
8
Posts: 640
Reputation: 9,701


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests