MonoGame.Extended icon indicating copy to clipboard operation
MonoGame.Extended copied to clipboard

I want to be able to select specific tiles to be rendered with transparency information (opacity)

Open Mephisztoe opened this issue 1 month ago • 0 comments

Right now, I can set a specific layers' opacity property to a value of my choice. This makes the TiledMapRenderer set the respectives layers' TiledMapEffect.Alpha property accordingly and thus renders a complete layer transparent.

If possible, I would like to be able to make only specific tiles transparent.

The idea is, that when a sprite controlled by a player hides behind a wall for example, I would like to be able to make a specific region transparent. Right now, I am basically rendering two different layers - one background and one foreground layer and the sprite in between. This way, the sprite can hide only behind the tiles that are defined on the foreground layer.

I would then identify if the sprite overlaps with one of these tiles and then think about a maximum range of tiles that are connected to the one that hides the player so that they can be rendered transparent while the player moves.

Here is an example:

image

I would also like to be able to tween the alpha value between values over time. So for instance, the alpha value is always like 1.0f and the moment the player enters an area where he hides behind a wall for instance, the alpha value gradually tweens down to .5f within a second.

Mephisztoe avatar Jun 17 '24 19:06 Mephisztoe