
[ad_1]
I’m utilizing this program referred to as Quadtastic which is a sprite sheet administration device that permits you to outline quads on a sprite sheet, identify them, and so on, and export to metadata with these names (+ place, measurement, and so on). It has a characteristic that mechanically numbers chosen quads from high left to high proper by sorting first by y axis after which by x.
Ideally I would like my sprites numbered on this order:
However, because of the arbitrary measurement of the sprites in my sprite sheet, the sprite recognized as the highest left wasn’t the precise high left sprite. Another sprite on the identical row had a bigger bounding field than it and thus had a decrease y place which triggered it to get sorted earlier than the precise high left one (which was sorted as fifth)
I attempted to change the supply code to strive a special algorithm the place I sorted by the space of every quad’s high left nook to the highest left nook of the minimal bounding field of all the chosen quads (a rectangle that encompasses all of them). This considerably labored and was in a position to appropriately kind the highest left sprite as the primary however a bunch of others had been incorrect.
So, the place can I’m going from right here? I can not actually consider every other algorithms for sorting. If anybody has any concepts for different algorithms I might strive, that’d be nice!
And, if anybody is questioning, the code for the sorting might be discovered right here.
If you need to run and take a look at algorithms your self you want the 32 bit model of Love 10.1. If you get errors about an lfs.dll, take it from the shared folder within the repo and put it within the base listing of 32-bit Love 10.1, the place love.exe, is and you need to be capable of run it.
[ad_2]