> I think you'll find some in the SDL games and engines databases. I
> haven't messed with isometric games under SDL so far, so I don't have
> any first hand experience with any of these projects.
I started working on a simple iso engine for a RPG game I was going to make
a few years ago and never did. It wasn’t great, but it was damned
It scrolled, but not smoothly. Your ‘character’ (e.g., a flashing spot
in the grid) remained in the center, and the world moved around it.
(Until you got to the edges, at which point, the cursor moved some.)
Depending on how complicated you want your world, drawing ISO should be
simple. In my world, I believe I had 2 levels of ‘height.’
I had the ground level, and then the ‘what’s on the ground’ level.
This let me place objects like trees, bushes and chests, on top of
arbitrary kinds of ground - like dirt, sand, grass and cobblestone.
Drawing the screen was simply a matter of:
/* Go from the ground up: */
for (height = 1; height >= 0; height–)
/* Go from the lower position on the map (closer to the viewer),
to a higher position on the map (further from the viewer): */
for (y = cursor_y + 5; y >= cursor_y - 5; y--)
/* Go from the leftmost position to the rightmost: */
/* (This assumes ISO shapes like this: // Rather than: \\ ) */
for (x = cursor_x - 5; x <= cursor_x + 5; x++)
/* Draw the shape on the screen: */
In that “…” part, I was able to use “x”, “y” and “height” to reference
different parts of a map array that looked like this:
Then, with regards to positioning stuff on the screen, it’s pretty much:
/* First, get X and Y according to the screen, not the map: */
centered_x = x - cursor_x;
centered_y = y - cursor_y;
/* Determing screen positions based on X/Y coordinates: */
screen_x = (centered_x + 11 - centered_y) * 32;
screen_y = centered_y * 32;
… for example.
This means the screen will be drawn according to the X/Y coords like so:
... ... ... ... etc.
0,2 1,2 2,2 3,2 ...
0,1 1,1 2,1 3,1 ...
0,0 1,0 2,0 3,0 …
I hope that makes sense. This is all kind of off-topic with regards to SDL,
though, so we should probably move the discussion elsewhere if it lasts
(Lest we incur the wrath of Sam ;^) )
-bill!On Tue, Mar 11, 2003 at 03:57:31PM +0100, David Olofson wrote:
bill at newbreedsoftware.com Hire me!