Some Confusion Regarding Array Sorting

0 favourites
  • 4 posts
From the Asset Store
A master sorting Puzzle fun and addictive puzzle game! A challenging yet relaxing game to exercise your brain!
  • Essentially I'm loading in data into an array and some data will be skipped, causing there to be some rows with 0's as values and I'm trying to get rid of those. Everything seems to be working fine aside from the array sorting function.

    The code im using

    The Array's data after loaded into array

    I Pop the data from the Y axis to remove the categories (which i add back at the end)

    I then sort by Y axis which -almost- works in that the 0's are properly pushed to the top however the values in column 2 and 3 are now mixed up.

    From the array documentation page it says that its suppose to preserve the contents of the column but it doesn't seem to be doing that here?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why don't you just search for zeroes and delete the row?

  • Why don't you just search for zeroes and delete the row?

    thats a... very good question

    I thought the delete function just sets the values to 0 but after looking into the documentation for it, for 2D arrays it just deletes that whole row so that will definitely work and I'll probably just do that instead.

    Any idea why the sorting function is acting that way though?

  • Looks like it is sorting each column individually which is how I would expect it to work

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