Plot isometric tiles ?

Started by
2 comments, last by VildNinja 14 years, 6 months ago
Hi! So I'm working on a game with isometric tiles. But I can't figure out how to plot the Y coordinate to draw each tile on. My map is a two-dimensional array. I use a double for-loop to analyze it and see what kind of tile it should blit. I know how to plot the X coordinate, but not the Y, at the moment it looks like this: http://img39.imageshack.us/img39/86/gameoh.jpg The yellow square is my temporarly player... So how do I do, lol ? Thank you! :)
Advertisement
the matrix I've calculated is
[ 1   ,  1 ][-1/2 , 1/2]


aka
x = x+y
y = (y-x)/2

this will rotate your map 45deg CW
You're close, you just need to overlap the tile rows. If you look at your picture, what you really want is for every other row to be touching at the top and bottom, so the rows in between need to be placed at half-tile position.

Which means you pretty much just do this:

def tileYInPixels(tileRowIndex, tileHeightInPixels) :     return tileRowIndex * (tileHeightInPixels / 2.0)
this is what the matrix will do:


- just prettier :D

This topic is closed to new replies.

Advertisement