Jump to content
  • Advertisement
Sign in to follow this  

Problem with "aligning" an object

This topic is 5212 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there! I've browsed all the articles on gamedev.net about isometric engines and tile based games, but did not found the solution I search in special. So I registered, and decided to ask for help within this forum. I have written a basic isometric engine, that looks like this: What you see here, is the map editor. I decided to write it first, to have a complete mapping system, when I start to develope the game. This engine I wrote, it works realy fine. As long as I place floor Tiles, as the two placed on the shot. But if I want to place one of this tiles, I get a big problem: If I place both of the tiles within my editor, it looks like this: So, what do I do, to get this view? This steps I go through, wenn displaying a tile > Layer 0 (Floor-Tiles):
Get the Height of the Tile to place (Image-Height)

Get the Width of the Tile to place (Image-Width)

Set the display X-Position to current X-Position of Draw Function, substracting the difference of the Image-Width from Tile and the Width of the Floor-Tilr

Set the display Y-Position to current Y-Position of Draw Function, substracting the difference of the Image-Height from Tile and the Height of the Floor-Tilr

To make this all a little more transparent, the Sizes are defined as follow (Theese are all 2D Bounds):
Width of a Floor-Tile  = 100 px }
Height of a Floor-Tile = 50  px } 2:1

Width of a Wall-Tile   = 128
Height of a Wall-Tile  = 174

When the draw function gets to a tile on position x:100,y:100 (2D Coordinates), and there is one of the walls addicted to this field, it would calculate this x/y position for drawing the tile:
wallY = 100 - ( 174 - 50 )
wallX = 100 - ( 128 - 100 )

So... I guessed, while writing the base functions of the engine, that this would automaticly move the wall tile onto the floor tile... in some way. Now I'm stucked into some caluclating and getting crazy about it. It would be great if someone here could telle me, how get the tiles > layer 0 working. [Edited by - Souldrinker on September 2, 2004 9:10:20 AM]

Share this post

Link to post
Share on other sites
Certainly the problem does not show up clearly ;) But the second screenshot realy isn't too clear.

The problem is the align of the walls, "overlapped" by the floor tiles. The tiles > level 0 are printed after the floor tiles, but I want to some kind of align the walls to the floor tiles. But in case of the overlapped walls this doesn't work, and I'm searching vor a routine to determinate the sizes of a tile within my "3d" space. I only have the 2D space sizes (width and height of the image).

To excuse me, I'm from germany, so my english in this case isn't very well. The words to explain what the problem is, are somehow missing.

But I figured out my main problem by now. "Aligning" is the wrong word, to describe what I want to do, or better: what I can't do.

Let's see the tiles I have above. The floor Tiles are diamond shaped with 100 pixels width and 50 pixels height each. The Wall-Tiles are size 128x174 in their 2D Space (Image Size). If I draw a Wall-Tile at the current x/y Position in 2D Coordinate System, where I draw the floor tile, it simply does not fit. I'm now searching for a way, to bring the wall y-up (2D) to fit on the ground. Walls are surely the most simply example to do this. I've rendered a tree, which I also want to fit, but it doesn't (surprise ;)). I'm realy stuck into that for hours, but I don't find any solution - how do you solve this problem in your engines?

[Edited by - Souldrinker on September 3, 2004 2:12:21 AM]

Share this post

Link to post
Share on other sites
Ah, yes i didint realize that your structures are in block sets, LORM will solve this, (the method used in My Unsolvable Problem) search the forums for LORM and you should come up upon a few discussions.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!