summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-13 10:16:44 +0200
committerGitHub <noreply@github.com>2021-10-13 10:16:44 +0200
commitd742dcd3ceaa614d2688caed59ec0c75d4041985 (patch)
treee61e79010c93cb2c4f8174b26b1fbcc4a3d90abf /scene
parent74a87fe98bc7a7cb1268f7d153dfc1af0c06399a (diff)
parentbf3eaa767bc535a6d49ef599a17953bcb16b3614 (diff)
Merge pull request #53745 from KoBeWi/layerzzzzz
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/tile_map.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index a791d99c39..42c54a950d 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -848,9 +848,11 @@ void TileMap::_rendering_update_dirty_quadrants(SelfList<TileMapQuadrant>::List
Color modulate = get_self_modulate();
modulate *= get_layer_modulate(q.layer);
if (selected_layer >= 0) {
- if (q.layer < selected_layer) {
+ int z1 = get_layer_z_index(q.layer);
+ int z2 = get_layer_z_index(selected_layer);
+ if (z1 < z2 || (z1 == z2 && q.layer < selected_layer)) {
modulate = modulate.darkened(0.5);
- } else if (q.layer > selected_layer) {
+ } else if (z1 > z2 || (z1 == z2 && q.layer > selected_layer)) {
modulate = modulate.darkened(0.5);
modulate.a *= 0.3;
}