• Create Account

Banner advertising on our site currently available from just \$5!

# Djfix

Member Since 16 Aug 2012
Offline Last Active May 21 2014 02:59 AM

### Isometric map problem

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

### RPG Inventory HUD

31 August 2012 - 07:37 AM

Hello again gentlemen!

As the title of the topic suggests I have a bit of a problem with a drag-and-drop,Diablo 2-like inventory HUD/GUI.
I figured out how to handle the data part of the inventory (using an array) but my main problem is Linking the data part to a GUI.
Any ideas on that?

I am just asking for ideas,suggestions (not plain solutions, i want something to challenge my brain not take them by granted)...i can accept pseudocode, Python,Java,and C++ ideas because i can relate the solutions to my language of choice.

Thank you in advance!

### colorkey problems

24 August 2012 - 05:59 AM

Hello everyone...I've recently managed to put up some code for a tile based game and it's working well but i've encountered a problem.
I want to use non-colorkeyed images as base tiles(grass,dirt,rock,road), but if i draw a higher resolution image and load it with Pygame's basic image loading function (pygame.image.load) it lags a lot, but if i make the (0,0) pixel white and colorkey that, it works with no lag but it wrecks my tile grid's appearence.

Any ideas why that might happen?

### 2d overhead tiling "engine"

16 August 2012 - 10:08 AM

Hello gamedev.

This being my first post i'd like to first introduce myself.My name is Gabriel and I am 16 years old.

I've always had a great hunger for 2d adventure games.By this age I've played more than I could count (metaphorically speaking).

Now that my highschool has introduced me to programming I am baffled by the idea that I could make my own 2d adventure game.
Now with the formalities done I'd like to get to it.
I am quite confortable in the C++ language (doing it in school for 1 year plus my home learning), up to the point of classes and structures (I can implement something using these concepts but it doesn't come as natural as the other features of the language do), but my real experience in developing games comes with the Python programming language along with the SDL spinoff Pygame.

I dived in the Pygame documentation and learned all the functions and methods I deemed necessary for my game and shortly after that I started working on my first game: a Space Invaders clone. It turned out quite nice and it surely was a playable game but my dream is a overhead adventure game.

I know that for this type of game tile engines are the most widespread because of flexibility and memory conservation, so i set out on the stupendous journey of designing my own tile engine but as I advanced with the engine it simply became too overwhelming.Finally i managed to put together a simple,clean (this is a big lie), 1 layer engine that could load, display,and save levels quite nicely.

I now see how childish I was when i made my tile engine.My code seemed now like a zombie with only duct tape holding it in part.

Now I am sorry to have bored you with the stupidly long story but I have one thing to ask:

Can you please point me in the direction of basic multi layered tile engine making (not i am not asking for code snippets)?

Just the logical steps of designing a multi layered tile engine. (links to tutorials, some pseudocode-ish ideas would be a bonus)

Thank you!
PS:Excuse my english please...

PARTNERS