From 2131b3c61c8b7f7c91e7362f61016cd1ea896b94 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Mon, 26 Jul 2021 20:05:59 +0800 Subject: [PATCH] Fix selection of spaced atlas tile when using priority --- scene/resources/tile_set.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index ada48b808e3..134e3ba9553 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -662,7 +662,8 @@ Vector2 TileSet::atlastile_get_subtile_by_priority(int p_id, const Node *p_tilem } } - Vector2 coord = tile_get_region(p_id).size / autotile_get_size(p_id); + const Vector2 spacing(autotile_get_spacing(p_id), autotile_get_spacing(p_id)); + const Vector2 coord = tile_get_region(p_id).size / (autotile_get_size(p_id) + spacing); List coords; for (int x = 0; x < coord.x; x++) {