Overlapping sprites for perspective

Does anyone have a good implementation for drawing sprites in order with the greatest y value (the sprite lowest on the screen) being drawn last? I’m making an isometric game and I want a way the overlap my objects to give a sense of depth.


I found an awesome guide here. By the programmer of Head Over Heels.

1 Like

I think you meant the greatest y value, but close enough.

Just a heads up, I’d recommend using a regular array-based list rather than a linked list as the pdf suggests. Linked lists have a fair bit of overhead and the Arduboy doesn’t have much memory so generally they’re not worth using.

1 Like

Thanks! Edited. You were exactly right.

1 Like

Depending on how you store your map information. It’s pretty straight forward if you come from a linear datasource (2d or even 1d array).

Imagine your datasource to be a flat map from your world. Projected to isometric the top left corner of your array will be the farthest away in your projection.

That means that you draw columns row by row, then go to the next column.
So you start drawing the first tile at (0,0) followed by (0,1) and so on. Reached the end you jump over to the next column (1,0).

Here’s a small illustration in a 2:1 projection :

Small teaser: I’m doing this myself right now with great success. Expect it soon :wink:


Hey. Looks great!

So I figured that out. My level is stored in an array. But I’m having trouble with isometric projection. I change my Cartesian cords to move the player but I want to convert that to Isometric coordinates for the game screen. Can anyone help me with calculating the isometric projection?


Actually I think I’ve got it:

xIso = playerX - playerY;
yIso = (playerX + playerY) / 2;

Looks good!
I can recommend this read if you are interested in all the math.