• 2D
  • How to modify specific Tile (Sprite) variable within a TileSet

For the roguelike I'm developing I wish to add a gradient-like feel to the field of view of the character. To do so I decided to add a TileSet on top of the ground so that each tile would have a diferent alpha value depending on the distance to the player. It would be the same tile, just different alpha value.

However, I cant seem to find a way to modify a tile before or after placing it via code or otherwise. Is it even possible? If it's not, how could I go about my problem?

Thanks for any help!

5 days later

sounds more like a shader, i dont know how write shaders here in godot, but definitely you looks like the shader can be your solution.............

Now, other solution could be that you can add tiles with specified alpha to your tileset like:

line 1 - shadow tiles alpha = 1 line 2 - shadow tiles alpha = 0.8 line 3 - shadow tiles alpha = 0.6 line 4 - shadow tiles alpha = 0.4 line 5 - shadow tiles alpha = 0.2 line 6 - shadow tiles alpha = 0

then depending of the distance of your character you can replace the tiles with their respective alpha tile... but for performance i think that the shaders is better, i supose

If you want to go the shader route, I would suggest looking at the vignette shader from the Godot screen space shader demo. With some adjustments, you might be able to edit it to look like a gradient, though I have limited experience with shaders so I have no idea how doable it is.