How do I collide with only one object within an overlap?

Get help using Construct 2

Post » Tue Jan 24, 2017 9:32 pm

How do I have a bullet only collide with one of two or more overlapping objects.

So say I fire a bullet at 3 sprites that happen to be overlapping, how would I go about making it only destroy one of those sprites?
B
45
S
9
G
2
Posts: 141
Reputation: 4,197

Post » Tue Jan 24, 2017 9:56 pm

In general all events come the same form.

A condition that picks objects (the basic picklist is made in the first condition)
(in the same event, or as sub) A condition that starts picking from the basic picklist and refines
(in the same event, or as sub) More conditions that start picking from the refined picklist and refines
.......................... actions

In your case.

'Bullet' is overlapping another object 'Sprite'. (now the basic picklist contains 3 sprites)
'Sprite' > pick top/bottom

or
'Bullet' is overlapping another object 'Sprite'
system > pick random instance 'sprite'

or
'Bullet' is overlapping another object 'Sprite'
system > pick nth instance 'sprite', instance = zero

or
'Bullet' is overlapping another object 'Sprite'
Sprite > pick nearest to bullet.x .. bullet.y

The second condition always starts picking (choosing) from those picked in the first condition.
So, it always starts with those 3 'sprites'.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Jan 25, 2017 12:53 am

With a little help from Kyatric, we got to the bottom of this - it seems that you must use "Is overlapping" rather than "On collision with" in combination with "Pick top/bottom instance" or "Pick a random instance".

I am assuming that it's a bug that "Is overlapping" won't work in this fashion, but I'm not sure.

Sample project for those that are interested: http://www.sean-noonan.com/development/ ... erlap.capx
B
45
S
9
G
2
Posts: 141
Reputation: 4,197


Return to How do I....?

Who is online

Users browsing this forum: Hassan Hackmi and 8 guests