Monday, February 21, 2011

Isometric math

I have some basic code working that draws an 8x8 isometric area with no support for anything yet, except embedding. Here, I'm attempting to embed it below:

I ended up having three coordinate spaces. One is the world space, which starts at (0,0) and grows like usual, woX increases 1 pixel to the right, woY increases 1 pixel down. Then I have a "window space", which is like world space except it takes scrolling into account. Then there's tile space which also starts at (0,0), I'm calling the basis U and V, which hop from one tile to the next.

All I had to do so far was to transform between these spaces and figure out how to set the window transformation so that the tile area would be centered.

I still feel unhappy about how to store the tiles. I don't want to specify the center point and extents for each tile by hand, but how else can I cut them out from a sprite sheet?