xobust / Project-Broban

ProjInda15 project
5 stars 2 forks source link

Fix draw depth #63

Closed willwull closed 8 years ago

willwull commented 8 years ago

Currently, all sprites are drawn on top of each other depending on the order in which the sprites are drawn. However in the final game, objects that are lower on the screen should be "above", or in front of, objects that are higher on the screen.

depth

xobust commented 8 years ago

Is there a way to set depth order of a draw call? Or do we have to arrange the draw calls ourselves?

iRobsc commented 8 years ago

This is something we handle in the draw function for each game object. We use the spritebatch.draw function to draw different layer dephts: https://msdn.microsoft.com/en-us/library/ff433989.aspx

With the ratio it says: a float from 1-0 where 1 is the bottom layer and 0 is the front layer. All we have to do is to divide the y position with the screen height to get a value from 0-1.

iRobsc commented 8 years ago

Is that ok with everyone? @xobust @willwull

willwull commented 8 years ago

Yes that sounds good to me :ok_hand:

xobust commented 8 years ago

Ez katka

xobust commented 8 years ago

Can we close this now or is there more to fix?

iRobsc commented 8 years ago

Yeah ofc we can close it :+1: