how do i change the order?
You'll need to draw them in the order you want them to appear in... first at the back, last at the front.
Perhaps you'll want to keep a list/array of the z-order level of each object, and as they move about, rearrange the list.
Then draw the objects by processing the list in order, where the first drawn object is farthest away.