Check collision against other instance of same object

  • 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).

    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:

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

    Kind regards

    Patrick

  • 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...

  • did you mean like this?

    Doesnt work

  • no, in the object condition, in the instance variable section, there is "pick highest/lowest"

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • i have tryed both your suggestions, and in both cases the project just crashed... but thank you very much, i will keep trying...

  • B4 i make you an example, do they keep adding/substracting points as long as they overlap (timed) ?

  • Here's an example with the family idea:

    https://dl.dropboxusercontent.com/u/542 ... bbles.capx

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)