User Tag List

Results 1 to 4 of 4

Thread: Dealing out an ID value based on X position?

  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 Dealing out an ID value based on X position?

    Is there a way to automatically sort an ID in some instances of identical objects based on their X position? So the object furthest to the left gets an ID of "0" the object with the next lowest X pos gets id "1" and so on?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    rubes's Avatar
    Join Date
    May 2011
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I needed to do a similar thing but from top to bottom. I'm sure my approach wasn't the most optimized it could be, but i got it to work. It required two nested loops, one to loop through the width of the screen (for your example), 0-???, then a loop of each object to see if its X coordinate matched the index for the Screen Width Loop. Prior to launching either loop, set global variable for Rank, and set that to 0. If you have an object where the x coordinate matches index for screen width loop, set that object's alterable value to Rank, and add 1 to rank.

    In the future, I'm going to replace my system like this with something based on a bubblesort algorithm that Chris Burrows put together. I can't find it now, but I'll try to post a link to that later on...

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    rubes's Avatar
    Join Date
    May 2011
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's an example file of the nested loop I was talking about. The actives are drag and droppable, click rank em to assign values based on x position. I would be interested to hear how others might optimize this, as it is cycling through a lot of loops.
    Attached files Attached files

  4. #4
    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)
    Thanks for the example!

Similar Threads

  1. Dealing with the app going into the background
    By mobichan in forum iOS Export Module Version 2.0
    Replies: 4
    Last Post: 14th January 2013, 08:53 AM
  2. Aiming based on Mouse Position
    By playfair in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 24th November 2012, 04:53 PM
  3. Position based audio?
    By Super196 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 18th January 2012, 05:47 PM
  4. Flag Based Inferior-Position Menu Bar
    By Gatesmi in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 1st April 2011, 03:52 AM
  5. Ordering duplicates based on Y Position
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 10th August 2009, 04:03 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
  •