I’m creating a game with a 3/4 view top-down 3x3 tilemap. I want the player sprite to appear in front of background walls while going partly behind foreground walls.
Here is my tilemap:
I used Godot Autotile Texture Templater to create the template to allow for TileMapLayer terrain creation, created the art, added to Godot and created my terrain using which is using corners and sides matching:
So far, so good. Terrain editing works exactly as it should.
The problem is that I want my player to be able to go behind foreground walls while staying in fron of background walls. This isn’t a problem on tiles with only a foreground wall or only a background wall, but is a problem in tiles with both, like this:
There is no fixed y-sort value for the tile that will satisfy both.
I could break up my 32x32 tiles in to something smaller (they are formed from 8x8 sub-tiles), however I think I’d lose the ability to use the terrain tools if i did this. Is there any way to create 32x32 tiles, but with more granular y-sorting?
Another idea I had: dynamically adjust the y-sort offset of my player sprite depending on what part of the TileMapLayer tile it’s overlapping (the player sprite is not tall, so will never have to be simultaneously behind and in front of different walls within one tile, though that may not be the case for other games I make).
Any suggestions?