godot4.4
As shown in the red box in the picture, I know what to do if it is a tile of tscn scene type, but how to highlight an object composed of a single or multiple tiles?
godot4.4
As shown in the red box in the picture, I know what to do if it is a tile of tscn scene type, but how to highlight an object composed of a single or multiple tiles?
What if you just composed a square selection box as a png image, scaled it to fit the selected object, then put it at the objects position snapped to the same grid size as the tilemap?
This method will highlight the entire grid, all I want is to highlight the colored pixels in the image
No it wouldnt, because if you just scale the selection box to the object, as long as the object doesnt take up the entire screen, it will highlight just the object.
If it’s a scene tile, I would do this kind of highlighting effect, but if it’s a large tile composed of multiple tiles, I can think of dynamically changing its module.
An idea is that you could keep a dictionary in a Singleton that is like
{
“anchor” : [4,4]
“wardrobe”: [2,4]
“earth”: [1,1]
}
And then you can figure out what the player is hovering over, look up its id in the global dictionary, and then use the array [length,height] to scale the selection square on its x/y axis.
I found a method to use a new tilemaplayer as the tile effect layer. When a tile triggers an effect, the tile set of the triggered tilemaplayer is given to the tile set of the effect layer. Then, based on the source ID and coordinates, the tiles are placed in the tile effect layer. Finally, the tile effect of the effect layer is processed. The advantage of this method is that if there are new effects, they only need to be written on the tile effect layer