#25311 - Istondil - Fri Aug 20, 2004 11:09 am
Isometric tiles & overlapping
I?m currently rather busy with designing a small puzzle game in an isometric environment. I intend the levels themselves to be tiled backgrounds, but I?m unfamiliar how to place sprites so that overlapping is properly displayed. I?ve tried searching the forum and websites for tips & tricks but haven?t found anything helpful thus far. Hope some of you will be able to give me some pointers.
Here?s a sample iso map with height difference. Height/location data is stored in an array for mathematical purposes. This map can be generated using a standard tileset.
Pretty straightforward, we place a sprite on one of the tiles on the foreground. Visually this is a correct placement of the sprite. The sprite overlaps the elevated tile in the center. The height/location array is used for determining the position of the sprite.
Here the sprite is moved to the north (visually northeast). Once again the height array is used to give the sprite an additional y-offset. All still fine and dandy.
Here the trouble starts. I moved the sprite a tile westward. The x/y position is correct but because the elevated tile doesn?t overlap the sprite image it looks like the graphic is floating several squares above the original position. The desired effect would be to partially hide the sprite as shown in 4b. This could be achieved by adding another tiled background layer which contains the elevated tiles that should overlap, but? I?m afraid the following flaw would occur:
A rather awkward picture - The sprite is closer to the viewer than the elevated tile, but it still gets overlapped by something that is visually further away.
The question:
How would I solve the problem of overlapping or displaying partial sprites to display a visually correct isometric environment? At certain x,y locations the sprite should be overlapped, and at other x/y locations the sprite should be overlapping. Is this even possible by using tiles for the level layout or should I use sprites to overcome difficult level sections that require complicated overlapping?
I?m currently rather busy with designing a small puzzle game in an isometric environment. I intend the levels themselves to be tiled backgrounds, but I?m unfamiliar how to place sprites so that overlapping is properly displayed. I?ve tried searching the forum and websites for tips & tricks but haven?t found anything helpful thus far. Hope some of you will be able to give me some pointers.
Code: |
Image 1: Sample iso map _ _ _ / \ _ _ / \ _ _ _/ \_ _ _ / \ _ _ / - - \ _ _ / \ _ _ / _ / \ _ \ _ _ _ / / \ \ _ _ _ / \ _ |\ _ _ /| _ / \ _ _ / \ _ | \ _ _ / | _ / \ _ _/ \_ | \ _ _ / |_/ \_ \ _ _ / \ _ | _ / \ _ _ / \ _ _ / \ _ | _ / \ _ _ / \ _ _ / \ _|_ / \ _ _ / \ _ _ / \ _ _ / \ _ _ / \ _ _ / \_ _/ \_ _/ \ _ _ / \ _ _ / \ _ _ / |
Here?s a sample iso map with height difference. Height/location data is stored in an array for mathematical purposes. This map can be generated using a standard tileset.
Code: |
Image 2: An added sprite _ _ _ / \ _ _ / \ _ _ _/ \_ _ _ / \ _ _ / - - \ _ _ / \ _ _ / _ / \ _ \ _ _ _ / / \ \ _ _ _ / \ _ |\ _ _ /| _ / \ _ _ / \ _ | \ _ _ / | _ / \ _ _/ @@@@@@ \ _ _ / |_/ \_ \ _ @@@@@@@@@@ | _ / \ _ _ / \ _ _ /@@@@@@@@@@ \ _ | _ / \ _ _ / \ _ _ / @@@@@@@@@@ \ _|_ / \ _ _ / \ _ @@@@@@ _ / \ _ _ / \ _ _ / \ _ _ / \_ _/ \_ _/ \ _ _ / \ _ _ / \ _ _ / |
Pretty straightforward, we place a sprite on one of the tiles on the foreground. Visually this is a correct placement of the sprite. The sprite overlaps the elevated tile in the center. The height/location array is used for determining the position of the sprite.
Code: |
Image 3: Moved the sprite _ _ _ / \ _ _ / \ _ _ _/ @@@@@@ \_ _ _ / \ _ @@@@@@@@@@_ _ / \ _ _ / _ / @@@@@@@@@@ \ _ \ _ _ _ / / @@@@@@@@@@ \ \ _ _ _ / \ _ |\ _ @@@@@@ _ /| _ / \ _ _ / \ _ | \ _ _ / | _ / \ _ _/ \_ | \ _ _ / |_/ \_ \ _ _ / \ _ | _ / \ _ _ / \ _ _ / \ _ | _ / \ _ _ / \ _ _ / \ _|_ / \ _ _ / \ _ _ / \ _ _ / \ _ _ / \ _ _ / \_ _/ \_ _/ \ _ _ / \ _ _ / \ _ _ / |
Here the sprite is moved to the north (visually northeast). Once again the height array is used to give the sprite an additional y-offset. All still fine and dandy.
Code: |
Image 4a: Incorrectly displayed sprite _ _ _ / \ _ _ / \ _ @@@@@@ \_ _ @@@@@@@@@@ _ / - - \ _ _ / \ _ _ /@@@@@@@@@@ / \ _ \ _ _ _ / @@@@@@@@@@ \ \ _ _ _ / \ _ @@@@@@ _ _ /| _ / \ _ _ / \ _ | \ _ _ / | _ / \ _ _/ \_ | \ _ _ / |_/ \_ \ _ _ / \ _ | _ / \ _ _ / \ _ _ / \ _ | _ / \ _ _ / \ _ _ / \ _|_ / \ _ _ / \ _ _ / \ _ _ / \ _ _ / \ _ _ / \_ _/ \_ _/ \ _ _ / \ _ _ / \ _ _ / Image 4b: Desired: Partially hidden sprite _ _ _ / \ _ _ / \ _ @@@@@@ \_ _ @@@@@@@@@@ _ / - - \ _ _ / \ _ _ /@@@@@@@@@@ / \ _ \ _ _ _ / @@@@@@@/ \ \ _ _ _ / \ _ @@@@|\ _ _ /| _ / \ _ _ / \ _ | \ _ _ / | _ / \ _ _/ \_ | \ _ _ / |_/ \_ \ _ _ / \ _ | _ / \ _ _ / \ _ _ / \ _ | _ / \ _ _ / \ _ _ / \ _|_ / \ _ _ / \ _ _ / \ _ _ / \ _ _ / \ _ _ / \_ _/ \_ _/ \ _ _ / \ _ _ / \ _ _ / |
Here the trouble starts. I moved the sprite a tile westward. The x/y position is correct but because the elevated tile doesn?t overlap the sprite image it looks like the graphic is floating several squares above the original position. The desired effect would be to partially hide the sprite as shown in 4b. This could be achieved by adding another tiled background layer which contains the elevated tiles that should overlap, but? I?m afraid the following flaw would occur:
Code: |
Image 5: My fears _ _ _ / \ _ _ / \ _ _ _/ \_ _ _ / \ _ _ / - - \ _ _ / \ _ _ / _ / \ _ \ _ _ _ / / \ \ _ _ _ / \ _ |\ _ _ /| _ / \ _ _ / \ _ | \ _ _ / | _ / \ _ _/ @@@@| \ _ _ / |_/ \_ \ _ @@@@@@@\ _ | _ / \ _ _ / \ _ _ /@@@@@@@@@@ \ _ | _ / \ _ _ / \ _ _ / @@@@@@@@@@ \ _|_ / \ _ _ / \ _ @@@@@@ _ / \ _ _ / \ _ _ / \ _ _ / \_ _/ \_ _/ \ _ _ / \ _ _ / \ _ _ / |
A rather awkward picture - The sprite is closer to the viewer than the elevated tile, but it still gets overlapped by something that is visually further away.
The question:
How would I solve the problem of overlapping or displaying partial sprites to display a visually correct isometric environment? At certain x,y locations the sprite should be overlapped, and at other x/y locations the sprite should be overlapping. Is this even possible by using tiles for the level layout or should I use sprites to overcome difficult level sections that require complicated overlapping?