• Create Account

## Isometric map problem

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1Djfix  Members

238
Like
0Likes
Like

Posted 12 July 2013 - 11:33 AM

Hello everyone!

Recently I have been trying to transmute all the knowledge I have about 2d top-down RPG games into knowledge about isometric tile maps.

After an hour of not having a fully functional internet connection and struggling with a pen and paper to translate the cartesian coordinates into isometric ones, i've finally found the formula (a damn easy one, indeed).

Once i've applied it to all my top-down tiles it seemed to give them an isometric view. Awesome!

But something went wrong. I've drawn a "grass" rhombus and a cube and I applied the same procedure with them. Bong!

The cubes are not joined together and the grass is way off from the center of the cube space.

I've uploaded a screenshot so you can see exactly.

This is my tile loading function (i'll cough up some pseudocode so everybody can understand)

function load_tiles(filename) // loads the level file
{
file = open(filename)
content = file.readlines() + [\r\n\] /* reads it as a two dimensional array (keeping the spaces)*/
for (t in range(length(file)))
{
line = content.strip(\r\n) //takes it line by line
for (tileNum in range(length(line)))
{
if (line[tileNum] == '0')
tiles.append(Tile(t*64,tileNum*32,grass) /* appends a Tile class reference (first argument being the x (index * imageWidth), second the y(index*imageHeight), and third the image)*/

if (line[tileNum] == '1')
tiles.append(Tile(t*64,tileNum*64,cube)
}
}
}

function 2dToIso() /* transforms the tile cartesian coordinates to isometric ones*/
{
for tile in tiles
{
newX = tile.x - tile.y
newY = (tile.x+tile.y)/2
tile.x = newX
tile.y = newY
}
}


the level file looks like this:

1111

1001

1001

1111

#### Attached Thumbnails

Edited by Djfix, 12 July 2013 - 04:32 PM.

### #2KnolanCross  Members

1935
Like
1Likes
Like

Posted 12 July 2013 - 04:09 PM

Have you tried using objects of the same size? It seems to me that this is what is causing the problem.

http://www.gameproducer.net/2011/09/18/illustrated-newbies-guide-to-isometric-game-development/

The formula is similar to the one you use and the author used an half size difference to simulate height, maybe this is the problem.

Currently working on a scene editor for ORX (http://orx-project.org), using kivy (http://kivy.org).

### #3Djfix  Members

238
Like
0Likes
Like

Posted 12 July 2013 - 05:04 PM

This change makes it work, but i'm not sure whether it is...good...or elegant...and i'm sure it will mess with getting the tile positions and so forth...

for (tileNum in range(length(line)))
{
if (line[tileNum] == '0')
tiles.append(Tile((t*32)+160,(tileNum*32)-32,grass))

if (line[tileNum] == '1')
tiles.append(Tile((t*32)+128,(tileNum*32)-64,cube)
}


it gives me this:

#### Attached Thumbnails

Edited by Djfix, 13 July 2013 - 03:34 AM.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.