Hi dudes.
So I don't really know what this particular thing is called, so I decided to call it "draw order depth" because it kindof describes what it is.
SO, I've been having some trouble figuring out this relatively simple thing, depth in 2D.
So imagine you're a dude running around in a semi-tilted camera view (or isometric), and you want to run behind a tree or a house. What SHOULD happen is that the house should now be in front of you, obstructing the view for the camera. Very basic concept, things closer to the camera should be drawn last, so the things behind it gets drawn over (and that way, creating depth). I included an image illustrating what I'm talking about.
So it seems simple enough, but what is a good and efficient way of coding this? Is it putting everything in an array, and using an algorithm to sort them in order how far away from the camera they are, then just run through the list? If thats the case, how do you do it efficiently?
One thing I tried, but which took up way too much CPU, was to cut the screen up to slices horizontally, and go through every slice, check every object to see if they are positioned on that particular slice, and if they were, draw them. Were I thinking in the right direction?
Any answer is appreciated!
Have a good one
~Vrokulaf