So I am new here, I have often used GameDev.net to find answers to problems I have had previously but never really come to the stage of registering to ask a question... however a bug that I have been stuck on for 18 hour straight has brought here. Apologies if this is in the incorrect section.
I am developing an Isometric map for a game that I plan to develop in the near future. I based my implementation on the tutorials found here.
My issue is the following, when I try to draw objects that require more than one tile (for example a building), it seems as though my depth handling goes out of the window. When I place the building, I set all tiles below it to be unwalkable. This was tested by initially setting those tiles to be another tile to check I have the correct ones (which I do), I then took this further by drawing the building to test if it worked and I noticed that the building was being drawn on top of the player.
My tiles are split into three types, base, overlay and height. The base type is used for the ground (grass), the overlay type is used for things such as bushes, water, trees ect, the height type is used for mountains and hills. I set my building to be an overlay type.
Obviously the building needs an "origin" cell. This is the cell that holds the actual overlay texture.
To view images that will help explain the issue more go here.
In these images, the origin tile is the highlighted (slighty) red tile.
As you can see, in the incorrect image the building is drawn on top of the player. Hence my reasoning for thinking that it is a depth issue.
How I have tried to fix so far:
- Set the depth of the cell to be the same as the origin cell
- Draw a transparent cell on top of each cell with the correct depth that tile should have
I have searched high and low for someone who has the same issue as this yet no one seems to have it! I have also looked for resources explaining it but with no avail. My only theory on how to solve this is cut the image up into tile images and then place them on the map tile by tile.. however I would rather not do that as it is absurd.
Just to make it clear, my depth handling does work for all other scenarios such as walking behind hills/mountains/trees.
Has anyone heard or seen this before? Any help will be greatly appreciated.. I have been working on this bug for a good 18 hours straight now and I am feeling slightly disheartened by it.
If you need to see the code, I can send you a copy.
PS If I have missed something crucial just let me know and I will try and provide the details.