• Create Account

### #ActualDjfix

Posted 12 July 2013 - 04:32 PM

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

### #2Djfix

Posted 12 July 2013 - 02:52 PM

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
}
}



### #1Djfix

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
}
}



PARTNERS