flame icon indicating copy to clipboard operation
flame copied to clipboard

Support dynamic changes to the layer opacity on tiled maps

Open gotnull opened this issue 1 year ago • 5 comments

Problem to solve

I would like to be able to modify the layer opacity on a tiled map.

Proposal

Being able to access a layer:

final backgroundOff = game.tileMap.getLayer("Background");

..and set its opacity:

backgroundOff.opacity = 0.5;

More information

No response

Other

  • [ ] Are you interested in working on a PR for this?

gotnull avatar Mar 05 '24 04:03 gotnull

Is this something that the team is working on at the moment?

gotnull avatar Jun 09 '25 06:06 gotnull

It is not, would you like to be assigned to the issue?

spydon avatar Jun 09 '25 06:06 spydon

I just tried, it already seems to work?

spydon avatar Jun 09 '25 06:06 spydon

I just tried, it already seems to work?

final hiddenLayer = game.map.tileMap.getLayer<TileLayer>(layerToReveal);
  if (hiddenLayer != null) {
      hiddenLayer.opacity = 0.5;
  }
}

This didn't set the opacity for me.

gotnull avatar Jun 09 '25 07:06 gotnull

Maybe it only works on some types of layers then, could you add a Minimal Reproducible Example?

spydon avatar Jun 09 '25 07:06 spydon