I basically need a link to a turorial or good explanation on how to achieve efficient ZOrdering. I have some ideas, but I thought it wise to make sure there is no simple method of doing it before I go and butcher my code.
Btw, yes I've searched over the net but havn't found any good tutorials.
My original idea was to make a collection that stores data for drawing to the screen. So instead of drawing each sprite after all the calculations are made and new positions are updated, it just adds some data to this new collection about how to draw the sprite. Then before DD flips I call some sub which arranges the data from least to greatest according to the Y value for each chunk of data. After all of the sorting is done, it then blits everything from the top to bottom, making sprites with higher Y values drawn over top other sprites with a lesser Y value, thus making a zordering effect.
I have not tried this yet because I think it will take to much time to do and cut down on my fps. Would this be alright to try or are there more efficient methods of going about this?
Ok, I see what you're saying. Could the array be a UDT with info on how to draw the character? Then the bouble sorting sorts the array from least Y value to greatest Y value then blits them in that order? But I don't really understand why to sort only one character each frame. Could maybe an example be supplied?
You should only add refrence numbers in the array to make the sorting as fast as possible. Usually a app runns at about 60 fps which means you would have to have more then 30 characters to really notice that you only sort one each frame, and sorting one each frame is the absolute fastest way. And if there should be more characters on each frame add a if for it and sort 2 characters each frame.