|
The Basic's of Isometric Map
Drawing.
getting the Isometric isn't as hard as
you'd first think, 1st draw a grid on a piece of paper, turn it
45 Degrees and tilt it 45 Degrees what you see is an Isometric Grid.
Now the 1st point of your grid
is farthest away form you and if you number you're grid
will be 0,0 1,0 is
1/2 tile length to the right and 1/2 tile height down 2,0 is 1 to the right and 1 tile
height down, etc...
so to work out an x,y position
of a tile on screen from you're grid you:-
TileXpos=((x-y)*
TileLen/2)+ScreenWidth/2
TileYpos=((x+y)* TileHeight/2)
if your tiles
are 12x6 your tile 0,0 is placed at screen coords
TileXpos=((0-0)*12/2)+640/2
= 320
TileYpos=((0+0)*6/2) =
0 etc.
you really need a bigger tile that 12x6 I use 74x37 you can speed this calc up by pre
calculating some of the values eg.
12/2 =
6, 6/2 = 3, 640/2 = 320 so
TileXpos=((x-y)*HalfTileLen)+HalfScreen
TileYpos=((x+y)*HalfTileHeight
so long as you
draw your tiles from left to right, from back to front you'll end up with an Isometric Map.
so :-
For y=0 To 9
For x=0 To 9 '(a 10x10 map)
TileXpos=((x-y)*HalfTileLen)+HalfScreen
TileYpos=((x+y)*HalfTileHeight
DrawSprite TileXpos,TileYpos,Map(x,y) ' where DrawSprite is
your own DX sprite Blit code
Next x
Next
y
This should give you some ideas
as to how to go about getting an Isometric map, as you can see
the principle isn't that difficult, you can speed the whole thing
up again by realizing how the sprites are drawn. IE. the next
tile is drawn half way across and down from the previous one. so
you could just add these values instead of calculating them each
tile, but I'll leave that up to you.
Good luck with you're programmes.
Rob.
|