|
|
On Fri, Nov 13, 2009 at 07:52:47PM -0800, Tivoilos wrote:
> I am talking about moving my player Isometricly
What I do is represent everything in a standard 2D map,
but then simply display it using isometric tiles:
/\
\/
Because isometric makes it easy to do a 3rd dimension,
I create a basic little map that was WxHx2.
(The ground, and objects sitting on the ground.)
I then displayed them in such a way that things
overlapped correctly. A simple "painter's method."
for (z = 0; z < 2; z++) { /* Ground, then objects */
for (y = 0; y < 10; y++) { /* Scrolling around a 10x10 view of the map */
for (x = 0; x < 10; x++) {
c = map[z][y + mapy][x + mapx]; /* mapx,mapy is where we've scrolled */
drawshape(CTRX + x * 32 - y * 32, TOPY + y * 16 + x * 16, c);
/* CTRX,TOPY is top middle of where window into the map is to be drawn;
tiles are 64x64 */
}
}
}
Here are three example tiles (at approx 1/10th scale ;^) ):
1. A cube:
..XX..
XXXXXX
==XX--
===---
===---
..=-..
2. Ground
......
......
......
..##..
######
..##..
3. Tree
..88..
.8888.
..88..
..||..
..||..
......
In this case, if I were to draw the ground first, then the wall, the
ground would be completely covered by my wall. But with the tree,
I get:
..88..
.8888.
..88..
..||..
##||##
..##..
And, of course, when multiple objects are drawn adjacent to each other,
they tile nicely:
......
......
............
............
..88....XX........
.8888.XXXXXX......
..88..++XX--......
..||..+++---......
##||##+++---......
..######+-###.....
############
..########..
######
..##..
Or there 'bouts.
I wrote a little program that let me pan around an iso map.
It was about 415 lines of code. :)
-bill!
_______________________________________________
SDL mailing list
SDL@xxxxxxxxxxxxxxxx
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
|
|