User Tag List

Results 1 to 10 of 10

Thread: Attaching several objects to several objects?

  1. #1
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Question Attaching several objects to several objects?

    I have an event that creates 8 objects A that all is set to a certain angle to as to create a "flower" type of image when they are attached to another object B. This works very well if I only have 1 of object B. But how do I do it if I want for example 3 copies of object B and I want them to have 8 A objects each? I tried to just continue creating 24 A objects hope that they would split up evenly between the object B, but I guess that was quite naive..

    I have an example here with two frames. In frame 1 there is 1 of object B and you can see the "flower" when you start the frame. In frame number 2 however I have 3 of object B and I create 24 object A, and as you can see it does not work..
    Attached files Attached files

  2. #2
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    5 downloads and no solution?

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fanotherpg's Avatar
    Join Date
    Jul 2006
    Location
    High Wycombe, Buckinghamshire, UK
    Posts
    3,663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wouldn't it be better to use Fast loop instead of group activation? I'm just learning it, so I can't help for time being.

  4. #4
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2011
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah fast loops are needed.
    (Bunch of angle events. Didn't know if they needed to be specific)

    View MFA

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS 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)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like this? ( 3 conditions, 4 actions )
    Attached files Attached files

  6. #6
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Are you able to use the 'Sticky Object' or do you have to export to some exporter?
    Working as fast as I can on Fusion 3

  7. #7
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by LB View Post
    Are you able to use the 'Sticky Object' or do you have to export to some exporter?
    I prefer no extensions, and definitely not if they are not supported by Flash Thanks for the examples! Oasuke:s one seemed to have an extension that is not supported by Flash though?

    About King_Cool:s one. I see it works, but how? I want to understand why it works to so I don't need to ask for help next time again: ) There seems to be no event for dividing the flower leaves up between the objects? How do they know that they should split up evenly? And how did you make one single event for setting them to their right angle? This "Set angle to - LoopIndex("CreateLeaf")*45". (Ah wait i think I get it? its 0*45 for the first one, 1*45 for next one, 2*45 for the one after that and so on right? Do the loopindex always start with 0?)

    Also will this work when I try to destroy one of the yellow objects? It should destroy the whole "flower" with all the leaves attached when it gets destroyed. Also the flowers will rotate in the real application. I hope this is no problem?

  8. #8
    Clicker Multimedia Fusion 2

    Join Date
    Aug 2011
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Outcast View Post
    I prefer no extensions, and definitely not if they are not supported by Flash Thanks for the examples! Oasuke:s one seemed to have an extension that is not supported by Flash though?
    Well it was the function object which is just an alternative to fast loops, which can be substituted for MMF2's default fast loops. (I just prefer the func loop)

    As for my example, I'll explain the steps. I used some alterable values for the two objects. they are"

    GlassJar Alt.A = Lock
    GlassJar Alt.B = fastindex
    Ray Alt.A = ID
    Ray Alt.B = fixed_v
    Ray Alt.C = lock

    Lock of ("GlassJar") = 0
    --> Activate Petal Create Group
    --> Set Lock of ("GlassJar") to 1.

    (This event just activates the fast loop group. You should always try to put fast loops in a group and have them deactivated later so they aren't always iterated through mmf2's loop.)

    [Petal Create]
    +fastindex of ("GlassJar") < 8
    --> Start fast loop "create_petals" and run NObjects( "GlassJar" )+8
    (I'll explain what the first condition is later. Basically you start the fast loop and run it +8 times since we need 8 rays for each glassjar.)

    On loop "create_petals"
    +Fastindex of ("GlassJar") < 8
    --> Create ("Rays") at (0,0) from ("GlassJar")
    --> Set fastindex of ("GlassJar") to LoopIndex("create_petals")

    (Okay so about this fast index alt.value. When a fast loop runs, it goes through a loop. Every time it finishes one loop, that fast loop's index goes up. So in this case, we need to have the glassjar record the fast loop index to make sure it stops creating objects for it when it reaches 8. That's the purpose of the first condition.)

    On Loop "create_petals"
    +("Rays") is overlapping ("GlassJar")
    -->Set ("Rays") fixed_v to ("GlassJar") Fixed Value.
    (This is used to ID each ray which so you can later destroy the glass jar and all the rays will be destroyed aswell. It's also great if you want to set specific angles or do other things differently for each ray.)

    On Loop "create_petals"
    +fastindex of ("GlassJar") = 1
    +Lock of ("Rays") = 0
    +Fixed Value of ("GlassJar") = fixed_v of ("Rays")
    -->Set Angle of ("Rays") to 45
    -->Set Lock of ("Rays") to 1.

    (Here is where we set the angles. When the index of the glass jar reaches 1, we set the angle then lock the condition so that it does not conflict with the other rays. Then when the index of the glass jar reaches 2, we do it again for the next ray and so on until it reaches 8 in total.)

    Only one action when event loops
    -->Deactivate Petals Create Group
    (Again when possible, always deactivate any group that has a fast loop in it)

    Mouse pointer is over ("GlassJar")
    +Fixed_v of ("Rays") = Fixed Value of ("GlassJar")
    -->Destroy GlassJar
    -->Destroy Rays

    (This event is only for destroying. When the mouse is over the glass jar, and the ray's ID match with the fixed value of the glass jar, both are destroyed.)

    Here's the example without the function loop object.
    View MFA

    ==================
    Just to explain some of those other questions
    how did you make one single event for setting them to their right angle?
    "Set angle to - LoopIndex("CreateLeaf")*45" just means that for each index loop the angle for the next leaf is multiplied by 45. So for example,
    index = 1, angle = 45
    index = 2, angle = 90
    index = 3, angle = 135
    And so on. It's good if things are done in multiplies. However it will be an issue when you want individualized angles.

    Do the loopindex always start with 0?
    no they are 1-based. 0*45 = 0. So it'll be 1*45 = 45 :p

  9. #9
    Clicker Multimedia Fusion 2 DeveloperiOS 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)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I made a new example, the Flowers can move and rotate with no problem. You can also destroy a Flower along with all its Leafs by clicking on it.
    ...
    I see your wondering how this is done, i have decided to call it the Magic Condition:

    Allways
    --> set Leaf position to Flower position

    Leafs will systematically divide themselves among the Flowers and reposition to them.
    However if all Flowers dont have the same number of leafs, the system breaks and you can expect some funky results ( there are workarounds however, like making Leaf invissible instead of destroying it ).
    Leafs are also able to read its "Parrents" data if told to do so in the same Magic Condition:

    Allways
    --> set Leaf position to Flower position
    --> Leaf set Health_ to Flower Health_
    --> Leaf set Angle to Flower Angle

    This Magic Condition is very powerfull imo, and ideal for pinning Sprite Objects to Collision Mask Objects, or Line Of Sight objects to Sprite Objects.
    Attached files Attached files

  10. #10
    Clicker Multimedia Fusion 2 DeveloperiOS 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)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm, my last example was kinda faulty ( leafs didnt attach correctly depending on how many Flower were in the frame, in short i set the angle for each flower wrong ), my new example should work and supports any number of Flowers correctly.
    Its possible to easily rotate the flower along witht its leafs by changing the Angle of the Flower. Flower can also move using any kind of movement.

    Actually explaining how this Magic Condition works is very hard, as i dont fully understand it myself.
    It is much easier to attach and pair up pairs off objects, like a Collisionmask and a Sprite, or a Sprite and a LineOfSight, than a Flower with multiple Leafs.
    ...
    I will however try to explain how the Magic Condition works:

    - Lets say you create, lets say, 5 Flowers ( yellow circles ). The Flowers are numbered in the order they were created, where first created object is number 1.
    - Then you create 10 Leafts ( purple ), 2 for each Flower. The Leafs are numbered in the order they were created, where first created object is number 1.
    - We then have the Magic Condition 'Allways --> Leaf set position to Flower'.

    What happens is,
    the Last Created Leaf will position to the Last Created Flower,
    the Secound Last Created Leaf will position to Second Last Created Flower
    the Third Last Created Leaf will position to the Third Last Created Flower
    the Forth Last Created Leaf will position to the Forth Last Created Flower
    the Fift Last Created Leaf will position to the Fift Last Created Flower
    the Sixt Last Created Leaf will position to the Last Created Flower
    And so the system goes on ( see illustration below )...


    As long as you are able to equally divide the number of Leaf amongst the number of Flowers, you have complete controll over this system.
    But lets see what happens if the Leafs are not equally dividable amongst the number of Flowers. Lets say we destroy Leaf number 8 and 10 ( wich belongs to Flower 3 and 5 ).

    Now what we would expect to happen is that Flowers 3 and 5 only have 1 Leaf instead of 2, but what happens is something different.

    The Leafs rearange themseves as people rearange themselves standing in a supermarket queue ( where the last created Leaf is standing infront of the counter ).
    So the results we see is that Flowe number 1 and 2 are missing a Leaf, when what we really did was destroy the Leafs for Flower 3 and 5.

    And this is why i say that you have to be able to equally divide the number of Leafs amongst the number of Flowers for this kind of attachment system to work.
    Attached files Attached files

Similar Threads

  1. Hidden objects (it thinks objects inside the screen are outside?)
    By SoftWarewolf in forum Android Export Module Version 2.0
    Replies: 0
    Last Post: 16th December 2012, 11:15 PM
  2. Compairing 'Objects AltValueA' to 'Objects AltValueB' dont work
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 8th May 2012, 12:27 AM
  3. Attaching shadows to active objects
    By Cybert9 in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 22nd January 2012, 07:08 PM
  4. Attaching multiple active objects
    By artician in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 2nd February 2009, 12:56 AM
  5. attaching objects
    By dub in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 6th December 2006, 11:02 AM

Posting Permissions

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