Check collision against other instance of same object

Get help using Construct 2

Post » Fri Jul 01, 2016 8:04 pm

So this rly bothers me, as i cant get it wo work.
Basically i have a bunch of instances of the same object floating arround. The object has the instance variable "points" which also determine the size of the object. When one instance overlaps another the instance with more points should gain points from the instance with less points. This work as long as only 2 intances are overlapping, if another 2 overlapping it does not work (only for the first instances overlapping while i picked instances by nth).
Image
I tryed to let each instance spawn another object, pinned it to the first object and set a variable UID but that also does not work:
Image

is there any working solution for this problem? Any help would be greatly appreciated.

Kind regards
Patrick
B
19
S
7
G
1
Posts: 222
Reputation: 2,546

Post » Fri Jul 01, 2016 8:38 pm

Have you tried like this :
1. pick the instances that are in collision (bubble is overlapping bubble)
2. inside this event, pick the instance which have the higher instance variable "points" and add 100*dt to "points" (for example).
3. just below, but still inside the 1st event, pick the instance which have the lower instance variable "points" and retrieve points.
I'm not sure it will work...
B
8
S
1
Posts: 76
Reputation: 628

Post » Fri Jul 01, 2016 10:00 pm

did you mean like this? Image
Doesnt work :(
B
19
S
7
G
1
Posts: 222
Reputation: 2,546

Post » Fri Jul 01, 2016 10:04 pm

no, in the object condition, in the instance variable section, there is "pick highest/lowest"
B
8
S
1
Posts: 76
Reputation: 628

Post » Sat Jul 02, 2016 1:39 am

There are other topics about this. The simplest is to use a family where the family contains "Sprite". Then you can do:
Sprite is overlapping family

That way each are picked in their own type.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Sat Jul 02, 2016 2:11 am

i have tryed both your suggestions, and in both cases the project just crashed... but thank you very much, i will keep trying...
B
19
S
7
G
1
Posts: 222
Reputation: 2,546

Post » Sat Jul 02, 2016 11:46 am

B4 i make you an example, do they keep adding/substracting points as long as they overlap (timed) ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Jul 02, 2016 6:09 pm

Here's an example with the family idea:
https://dl.dropboxusercontent.com/u/542 ... bbles.capx
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Sun Jul 03, 2016 3:21 am

at-99Instances2Go yes :)
at-R0j0hound Thanks you very much, i am not sure why i couldnt get this to work, i will studdy the example and implement it :)

thank you all for your help.
B
19
S
7
G
1
Posts: 222
Reputation: 2,546


Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot], unicornspitfire and 56 guests