User Tag List

Results 1 to 5 of 5

Thread: Centre a spread of objects

  1. #1
    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,117
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

    Centre a spread of objects

    Hey Clickers! Can someone help spark my brain for an obvious solution for this here problem....

    So I create a number of active objects and line them up one by one, I then want to center the objects relative to a parent object. See this attached image, the top blue box is what I have currently, I'd like to dynamically achieve the bottom box.



    I'd like to be able to center at any time I call on it, during or after the child objects creation..

    I've attached what I have so far.. I'm sure there's a simple way, but nothing is coming to me right now >_<

    Bonus points if it can work with variable width objects too, eg some objects being 32 pixels wide while the one next to it is say, 24 pixels wide, and it can still center them from end to end.
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,283
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    Centre_rev.mfa

    I added a few animation frames of different sizes to randomly pick from, but here is centering code for the window. Also added a var for spacing between the child objects. Enjoy!

  3. #3
    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,117
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    haha oh man too good! I can definitely work with this.. is there any chance though, it could be made so:

    1) the objects are created in a straight line ( no need to consider variable widths etc this time )

    2) *after* the objects have been created, say, a third button can then center the objects on a button click?

    Thanks mobichan!

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,283
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    1. Are you asking if you can make a straight line with only one fastloop? If the child objects are all a standardized size, then yes. Or are you talking about something other than the straight horizontal line it creates already?

    2. You would make a third button simply run the “Centre” fastloop when pressed. Not sure why you would want this but the fastloops can be run independently.

  5. #5
    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,117
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Thanks mobichan, I'll take a proper look tonight. What I want to be able to do during actual gameplay, is suppose I have 10-20 objects running around the screen, then on a given action, I want to loop through them and give them an ID (easy enough) and line them up in a straight line (also easy) the only part I struggled with was centre aligning them relative to another object after they've been lined up. I'll experiment with what you posted over the long weekend, 4 days off work woohoo!

Similar Threads

  1. Screen au centre de la scène
    By Bertard in forum Fusion 2.5
    Replies: 0
    Last Post: 19th October 2015, 03:18 PM
  2. Replies: 10
    Last Post: 14th January 2015, 04:43 PM
  3. centre X/Y of circular movement
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 1st October 2012, 02:16 PM
  4. R241 Bug - Do not centre checkbox
    By joewski in forum File Archive
    Replies: 1
    Last Post: 24th August 2006, 01:49 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
  •