Original Post
Hey Guys,
I was asking myself what would be the best way to order my entities drawn on my map in 2D space.
What I actually do is Draw the map background, Draw all entities (pawns + projectiles) in a given order, Draw the map foreground.
For all my entities, I need to draw them in Y coordinate order.
I could :
1. Order every time I draw on screen, every tick I go trough the whole array (ordered) and reorder using a simple bubble sort and continue to cycle until nothing requires ordering.
2. Order directly in the classes when moving. If an entity moved, it requires reorder.
I do not know much about reordering techniques and I will surely (or maybe?) not use C# LinQ OrderBy method.
Thank you for answers !
I was asking myself what would be the best way to order my entities drawn on my map in 2D space.
What I actually do is Draw the map background, Draw all entities (pawns + projectiles) in a given order, Draw the map foreground.
For all my entities, I need to draw them in Y coordinate order.
I could :
1. Order every time I draw on screen, every tick I go trough the whole array (ordered) and reorder using a simple bubble sort and continue to cycle until nothing requires ordering.
2. Order directly in the classes when moving. If an entity moved, it requires reorder.
I do not know much about reordering techniques and I will surely (or maybe?) not use C# LinQ OrderBy method.
Thank you for answers !