I’m working on a TD game with a forced (orthogonal?) view…basically the lower down the screen (greater the .y value) the ‘nearer’ to the viewer a sprite is. So basically the higher the .y placement, the later the sprite is drawn. I’m guessing that’s a pretty standard arrangement so you all get what I’m after.
I’ve been looking around for answers and the best fit seems to put every sprite, and scenery item (shrubs, trees, rocks) into one big display group (I have no clouds or flying things…so everything sits on the ground - hence one display group) and then send that displayGroup to a function that sorts their order based on the y co ordinate.
Seems logical. But…I’m a bit confused about when and how often that sorting function should be called. I’m presuming in the main gameloop? So every tick (my tick is set to 400) everything sprite is resorted to put things down in the right order. Is that the way to go even though…in every tick new sprites are being spawned?
Secondly…I’m a bit of a thickie…the .y sorting function. Can anyone point me in the direction of some code that does that, so I can see what to do?
thanks for any replies.
Alex scarrow