In a 2D isometric game, the player can be either behind a tree or in front of the tree.
I understand that in order to implement something like that, I need to draw the objects that are furthest away first and the objects that are closest to the screen last, but I don't know how to express that in C++.
How do I change the draw order of the objects during run time?
Like, when the player starts out behind the tree and then walks in front of the tree then I need to change "draw tree before player" to "draw tree after player"
I don't know how to write that at all.
(I'm using SFML and C++)