Use textures 64x32 in Tilemap 32x32

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Firty

I have a tilemap with cells size at 32x32. but I’m using 32x64 textures, and even bigger (64x96). I would need at the very least that by placing a 32x64 object it would use two cells, or change the size of the cell without messing up all the other objects. I want the player to place these objects where they want avoiding overlap. I will use Astar to move NPCs and I need to make the game understand that there is an object in that location (get_used_cells_by_id only returns the point where the object was placed.) If the object is 64x32 it will occupy two points, I need to make it happen.

by Google Translate…

:bust_in_silhouette: Reply From: Zylann

It is possible for the visuals of a tile to overlap with other cells, I have done that a few times in some of my prototypes, by aligning the sprite in such a way the bottom square is the actual tile. So it means the tile is still square but when it gets drawn it will overlap what’s behind, and when assembled they just line up nicely (i.e grass is taller, while the cell is just the ground part ; walls, where the cell is the bottom half).

However there is no way for one tile to occupy multiple cells at once. For these you’d need to use actual nodes because it goes outside the scope of what TileMap was made for, and trying to support that anyways would be a lot of work to pull, in addition to everything else this node supports (sprites, collisions, navigation, autotiles, bucket fill, lines, selection, Y-Sort, isometric grids, custom grids, occluders, chunks…).

Maybe that could be done if we could define some tiles as being “compounds” of other tiles (which you’d still need to define), and placed like “stamps” just as a shortcut to “placing them all one by one”, but in any case it either needs plugin work or a feature proposal.

thanks for answering.
I have two plans to do this.
1 ° Using a tilemap just to demarcate collision, I can make “composite” tiles by marking the adjacent blocks I want as occupied area. However I am not sure how I will handle rotation. But I still think I can.
2 ° create a tilemap for each proportion … Seems like a simple solution. 32x32 objects use one tilemap, 32x64 use another tilemap, and so on. Of course I will have to keep using the collision tilemap (this tilemap is actually for Astar to determine the possible paths).

I still prefer the first solution. But it will be a construction game (the player will be able to build the scenario), this is where my concern comes, because the player can not put the object in an invalid place, even if he rotates the object.

Firty | 2019-10-14 17:52