How do I Make a Bullet hit only 1 out of 2 overlaped objects

Get help using Construct 2

Post » Mon Jun 08, 2015 7:24 pm

I'm trying to make it so that if more than one enemy are perfectly overlapped with each other, a bullet will only hit the enemy that has the highest Z order.

I already have the enemies in a family, and I have a feeling it's a pretty simple solution, but I don't know a lot about this program and not sure how else to look this up.

Thanks
B
8
S
3
Posts: 49
Reputation: 698

Post » Mon Jun 08, 2015 8:13 pm

Use: 'For each Enemy order by Enemy.ZIndex, descending'. Destroy your bullet, destroy the Enemy and add 'Stop loop'.

That will order the enemies hit, and stop after the first one.
ImageImageImage
B
71
S
21
G
232
Posts: 3,696
Reputation: 129,868

Post » Mon Jun 08, 2015 8:59 pm

Hey thanks for the response. I did what you suggested, and it still hits both enemies. I may have not done it correctly. Like I said I'm not very familiar with this program :P

Image

Did I do something wrong?

Thanks
B
8
S
3
Posts: 49
Reputation: 698

Post » Mon Jun 08, 2015 9:06 pm

Change 'On collision' to 'Is overlapping'. It's harder to do this for collisions, as they come in individually.
ImageImageImage
B
71
S
21
G
232
Posts: 3,696
Reputation: 129,868

Post » Mon Jun 08, 2015 9:44 pm

blackhornet wrote:Use: 'For each Enemy order by Enemy.ZIndex, descending'. Destroy your bullet, destroy the Enemy and add 'Stop loop'.

That will order the enemies hit, and stop after the first one.



Couldn't you just use Enemy pick top/bottom instead of using the order by z-index?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jun 08, 2015 10:12 pm

:) I never even noticed that event. Yes that works.
ImageImageImage
B
71
S
21
G
232
Posts: 3,696
Reputation: 129,868

Post » Mon Jun 08, 2015 11:15 pm

Well switching it to "is overlapping" did the trick. Thanks for the help! :D
B
8
S
3
Posts: 49
Reputation: 698


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, ChesVCF, OBLIVION, shinkan, Solomon, yiuyiu6666 and 23 guests