How do I Test Number Of Collisions

Get help using Construct 2

Post » Wed Jan 21, 2015 1:28 pm

Image
EDIT: Posted an swf to show what I need https://dl.dropboxusercontent.com/u/1306951/col_dec.swf
----------------------------------------
This may be a simple questions, I need some clarification though.

How do you test number of instances of one sprite colliding with an instance of another sprite?

First step is understandable
Code: Select all
sprite A collide sprite B
=>Add 1 to collisions.

Second is a bit unclear.
Code: Select all
sprite A not overlapping sprite B
Trigger Once
=> Subtract 1 from collisions

It's not really what I need.

Anyone got a smarter approach?
Last edited by Android-Music on Wed Jan 21, 2015 5:36 pm, edited 2 times in total.
B
80
S
23
G
6
Posts: 240
Reputation: 7,761

Post » Wed Jan 21, 2015 2:14 pm

Possibly but first can you elaborate more on what your trying to accomplish cause your question "How do you test number of instances of one sprite colliding with an instance of another sprite?" would be successful with your first expression "sprite A collide sprite B
=>Add 1 to collisions."

so what is it your wanting to do when they are overlapping???
Need Sprites For Your Next Project?
100% Vector Animated Sprites
B
8
S
2
Posts: 170
Reputation: 1,086

Post » Wed Jan 21, 2015 2:26 pm

Eeeerhm, detect how many collisions happen?
B
80
S
23
G
6
Posts: 240
Reputation: 7,761

Post » Wed Jan 21, 2015 3:08 pm

is this what you are looking for
You do not have the required permissions to view the files attached to this post.
B
256
S
39
G
15
Posts: 1,984
Reputation: 41,038

Post » Wed Jan 21, 2015 5:31 pm

Nothing like that but it's a very interesting capx, thanks! :)
I think I should add some pictures or animations for better understanding in future, so here's a small swf animation to make things clear. https://dl.dropboxusercontent.com/u/1306951/col_dec.swf
B
80
S
23
G
6
Posts: 240
Reputation: 7,761

Post » Thu Jan 22, 2015 2:27 pm

Pick the A's that are overlapping B and then check A.PickedCount to see how many there are.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,670

Post » Thu Jan 22, 2015 2:44 pm

And it's important to note that if there are multiple B's in a single layout, you'll have to do a "for each B" to get the number of collisions of each one of them.
B
75
S
31
G
27
Posts: 1,000
Reputation: 20,735

Post » Thu Jan 22, 2015 7:58 pm

Wow that's some neat advice, I owe you many thanks guys!
B
80
S
23
G
6
Posts: 240
Reputation: 7,761


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests