How would I go about sorting a multi-dimenstional array?

This forum is currently in read-only mode.
From the Asset Store
Buildings - Isometric view - PNG transparent - multi styles, multi fonctions buildings
  • So I'm trying out some arrays and I would really like to know how I would sort the following array

    array(family's Y co-ordinate, family's variable, UID if necessary)

    So far it's proving to be a killer, I've looked up some sorting algorithms but I'm not too savvy on a lot of the lingo they use to define them. The sorting algorithms that looked nice were, bubble, gnome and possibly insert, I'm not sure how they apply to multi-dimensional arrays though.

    I want the array to look something like this when it's sorted (leaving UID out for now):

    5, 0

    5, 1

    5, 3

    10, 0

    10, 6

    10, 8

    etc

    So primarily sorting by the Y co-ordinate ascending, but if any of the family have the same Y co-ordinate then sort by their private variable ascending

    Is this possible at the moment? I'm assuming its to do with a bunch of nested loops, but it's 3:20am and my brain has imploded

    Remember, I'm not that mathy, you'll have to translate into english for me

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • For those that are interested, I got it working, however it didn't solve my problem so its back to the drawing board

  • Yeah there really is no specific way to sort floats or integers, other than making up your own.

    I wonder if its possible to have a object, or behavior that could do that for you.

    Edit I suppose Lucid's S plug could do it, perhaps he could give an example of how that might work.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)