User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: how to link two instantiates objects ?

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    arthurh's Avatar
    Join Date
    Sep 2010
    Posts
    951
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question how to link two instantiates objects ?

    Hi,
    i try to make a lot of ennemy with two parts : body and shield. i have 10 bodies and 10 shields. The shield doesn't collide with the body.
    There is a way to link two instantiate objet by an ID or something like this ? because i want that the shied move with the body and i can use collision/overlaping for that.

    thx

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    There is a very easy way to do this: Automatic pairing. Fusion automatically pair objects if there are an equal ammount of them.
    Simply have this event:

    * Always
    - Shield: Set position to [x,x] from Body.

    So if there are 10 shields and 10 bodies, each shield will find a body to be attached to.

    Keep in mind though, that this only works on actions that affect all bodies. You cannot have conditions that limits the selection of Bodies and expect the automatic pairing to work. The body must contain all the information that the paired shield will need.

    Another approach you can use, if the automatic pairing system does not suit your needs, is to use For Each loops. Always start a loop on the Body, and On ForEach Body, postion the Shield relative to the Body.

  3. #3
    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)
    Yes, that can be easily achieved with the builtin "autojoin" feature of MMF
    just create "body" and "shield" in the same event,
    and create a condition:
    always > set "shield" position at 0,0 from body


    Or, if you plan to link more than two bodyparts/items,
    if you don't create objects in runtime,
    or if you want additional control over the process,
    you could go with the much debated "always-foreach" combination
    (as I do...)

    Just assign each of your enemies an ID
    (it can be done with "spread value" to an alterable value,
    or you can setup a manual increment if again you want more control)
    then give the shield the same ID related to its body and:

    - always > count-for each "body" name "attach-shield"

    - on each one of "body" loop name "attach-shield"
    + id of "shield" = id of "body" > set "shield" position at 0,0 from body

  4. #4
    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)
    Whoops, I seem to often get there one minute later with the same responses

    Quote Originally Posted by Popcorn View Post
    There is a very easy way to do this: Automatic pairing. Fusion automatically pair objects if there are an equal ammount of them.
    Interesting though, I thought that auto-pairing was applicable just on creation of objects in the same event,
    is this also applicable to pregenerated (not in runtime) items assuming they have equal quantities?
    Or maybe I misunderstood?

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    arthurh's Avatar
    Join Date
    Sep 2010
    Posts
    951
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A great thanks for you Popcorn and schrodinger ! i test that !
    Have a nice day

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    arthurh's Avatar
    Join Date
    Sep 2010
    Posts
    951
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So i try but with no result... it seem i am too stupid... ^^ i sent to you what i made. Could you see what i do wrong ?
    Many thanks for four help !!!
    Attached files Attached files

  7. #7
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    DaveC's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Australia
    Posts
    2,132
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    you're over complicating it, fusion handles this for you (in this instance)
    Attached files Attached files

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    arthurh's Avatar
    Join Date
    Sep 2010
    Posts
    951
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Dave ! Thanks for your help. I made that in the first time. It worked. But now, with a lot of different ennemy (instantiate), i lost position, type of helmet or type of head when i make a for each loop... so i try to understand well with a very simple test how can i make a unique identifier for an active et how use it in a collision. I hope my explanation is understanding ^^ tell me if not !

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    arthurh's Avatar
    Join Date
    Sep 2010
    Posts
    951
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so ok. This is what i find with the fixed value : 2 loops for each for the 2 shields. Here is the mfa.
    Attached files Attached files

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    @schrodinger: Yes, it doesn't matter when the objects are created. As long as there are an equal ammount of both it works.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Download link of ForEach object is down
    By ASD in forum Extension Development
    Replies: 11
    Last Post: 8th January 2014, 08:07 PM
  2. Web Object - Get Link URL?
    By Gibbon in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 1st December 2010, 08:30 AM
  3. flame object link is dead .
    By piki in forum Extension Development
    Replies: 4
    Last Post: 7th January 2008, 09:44 PM

Posting Permissions

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