## Garry

Jan 26, 2006, 04:18 PM

Hello,

I am new to this forum (which is great by the way) and I am working on a game with an isometric viewpoint. I have worked out (Google is my friend) how to draw and click tiles in a staggered viewpoint - see image below:

The (simplified) routine I use to calculate the x,y coordinates for where to draw the tiles is (note, this is REALbasic code):

However, I want to know how to draw a rotated isometric viewpoint like so:

Any suggestions? I have tried for hours to work out where to draw the tiles to. I want to start drawing from (0,0) and I have been trying to figure the coordinates that the tiles should be put as we go from (0,0) to (0,1) to (0, 2), etc but I can't work out the algorithm. It would seem I need to do the following (assuming 64x32 tiles):

(0,0) = (0,0)

(0,1) = (-32, 16)

(0,2) = (-64, 32)

etc, and

(1,0) = (32, 16)

(2,0) = (64, 32)

Where negative x coordinates represent points to the left of the mid point of the x-axis (where the map is draw from).

Any help would be greatly appreciated.

I am new to this forum (which is great by the way) and I am working on a game with an isometric viewpoint. I have worked out (Google is my friend) how to draw and click tiles in a staggered viewpoint - see image below:

The (simplified) routine I use to calculate the x,y coordinates for where to draw the tiles is (note, this is REALbasic code):

Code:

`for y = 0 to (rows - 1)`

for x = 0 to (columns - 1)

' Calculate MapX

MapX = x * TileWidth

if isOdd(y) then ' shift MapX to the right

MapX = MapX + (TileWidth/2)

end if

' Calculate MapY

MapY = y * (TileHeight/2)

' Add this tile to the array

MapArray(x, y) = theTile

next x

next y

Any suggestions? I have tried for hours to work out where to draw the tiles to. I want to start drawing from (0,0) and I have been trying to figure the coordinates that the tiles should be put as we go from (0,0) to (0,1) to (0, 2), etc but I can't work out the algorithm. It would seem I need to do the following (assuming 64x32 tiles):

(0,0) = (0,0)

(0,1) = (-32, 16)

(0,2) = (-64, 32)

etc, and

(1,0) = (32, 16)

(2,0) = (64, 32)

Where negative x coordinates represent points to the left of the mid point of the x-axis (where the map is draw from).

Any help would be greatly appreciated.