0 votes

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 (getusedcellsbyid 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...

asked Oct 10, 2019 in Projects by Firty (18 points)

1 Answer

0 votes

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.

answered Oct 11, 2019 by Zylann (21,719 points)
edited Oct 11, 2019 by Zylann

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.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.