User Tag List

Results 1 to 3 of 3

Thread: Multiple instances of the same object moving towards each other?

  1. #1
    No Products Registered

    Join Date
    Dec 2015
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple instances of the same object moving towards each other?

    Sorry if this has been asked before, I couldn't directly find a thread with the same question.

    I'm trying to make two instances of the same object move towards each other. These objects are continually created throughout the application. Once there's 2 or more instances of the object in the play area, I want them to move towards each other, so that they can collide and form a larger object. I have given each object its own ID, but I wouldn't know how to integrate that in the conditions. What I tried:



    Conditions:
    - Number of Object > 2
    - Pick one of Object

    Actions:
    - Object > Look at (0,0) from Object



    This causes both instances of Object to move in the same, downward direction, instead of towards each other. I have a feeling that this happens because the Object is ordered to look at itself. If so, how do I tell it to look at the other instance? Or do I have to look in another direction for the solution? If you have any advice, thanks in advance.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    It's not very straightforward but can be done.

    Here's an idea,
    you will need a global value named "my_id", another named "target_X" and another named "target_Y":

    number of object > 2
    >>> start loop for each one of "object", loop name "look_at"

    on each one of "object", loop name "look_at"
    >>> set "my_id" to fixed value (object)
    >>> start loop "pick_another" 1 time

    on loop "pick_another"
    +fixed value (object) <> "my_id"
    +pick one of (object)
    >>> set target_X to X(object)
    >>> set target_Y to Y(object)

    on loop "pick_another"
    +fixed value (object) = "my_id"
    >>> set direction to Oangle(object,target_X,target_Y)/11.25

    Should work, but will pick "random" objects to look at (not being the same instance itself)
    ...how would you do when you have 3 or more instances?

    Should they look to the "closest" neighbor? Or to an "average" point among the others? Or..?

  3. #3
    No Products Registered

    Join Date
    Dec 2015
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, having more than 2 instances is almost always the case. Furthermore, most of the (formed) objects in this game are able to collide with a variety of objects, including another instance of itself. I'd like the particles to move towards their closest compatible neighbour. Below's an example of possible collisions between objects.

    A + A = AA
    A + B = AB
    B + B = BB
    AA + B = C
    AB + B = D
    C + D = CD
    CD + C = 2C-1D
    CD + D = 1C-2D
    CD + CD = 2C-2D
    Et cetera...


    Hope this clarifies the issue a bit. I'll try to use, but first try to understand, what you posted. In any case, thanks a lot for your effort.



    EDIT: In addition, I'd like the objects to only move towards each other while in proximity of each other (through the Advanced Direction Object).

Similar Threads

  1. A question on multiple instances of an object...
    By chickenlump in forum Fusion 2.5
    Replies: 3
    Last Post: 26th June 2014, 10:07 AM
  2. Faster Multiple Object Instances
    By Fanotherpg in forum Fusion 2.5
    Replies: 12
    Last Post: 16th March 2014, 01:52 PM
  3. Faster Multiple Object Instances
    By Fanotherpg in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 7th March 2014, 05:39 PM
  4. Shoot object of multiple instances
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 31st October 2011, 03:58 PM
  5. Multiple Instances of Object glitch
    By JimJam in forum File Archive
    Replies: 10
    Last Post: 5th March 2008, 11:44 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •