One piercing bullet to One Target from Group

Get help using Construct 2

Post » Fri Jun 28, 2013 4:41 am

Hi guys

Would you take your time to see these pics?



1. Black arrow is a bullet, it's armor piercing can penetrate anything, I want to do get one target, not the whole instances.


The observed result was:



2. Black arrow collides every instances. It's not correct.


The excepted result is:



3. Black arrow collides ONE instance, not the whole group.

Do you know what I mean?

Thanks in advance!
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Fri Jun 28, 2013 9:20 am

@Joannesalfa

why not test each instance coliding with the bullet and compare it to the target requirements.
B
51
S
16
G
9
Posts: 1,098
Reputation: 11,252

Post » Fri Jun 28, 2013 9:32 am

@Joannesalfa
Love this way of explaining a problem :)
I would just add a "hash*t" boolean on the arrow set to true when it first hits, and add a condition "X arrow hash*t" on the collision detection. This way, you can let your arrow go through the mob without destroying it and not trigger any other damage dealing after the first mob.
B
17
S
8
G
4
Posts: 473
Reputation: 6,221

Post » Thu Jul 04, 2013 3:34 am

@spongehammer @Guizmus

I'm sorry I missed this thread. I was very busy, now I really appreciate your help!

I tried to implement with your method and it worked like a charm :D


Besides, there another little help, I implemented another method which uses touch, not bullet. I'm having this problem too... "on touched" input can destroy a group of instances togheter with global variable as boolean, I couldn't figure out.

Here is .capx contains 2 layouts

One is working, it uses bullets and another layout, it uses touch.

https://dl.dropboxusercontent.com/u/76227787/TouchInstancesProblem.capx

Would you take your time to see this problem?


Thanks in advance.
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Thu Jul 04, 2013 4:39 am

The On touched is picking all of the touched instances. You then need an extra step to pick one of those. Try Pick nth instance. IE: Pick sprite instance Sprite.PickedCount-1
ImageImageImage
B
71
S
22
G
259
Posts: 3,793
Reputation: 143,702

Post » Thu Jul 04, 2013 7:45 am

@blackhornet brillant.... It seems a trick, anyways thanks! :)
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 24 guests