summaryrefslogtreecommitdiffstats
path: root/scene/2d/tile_map.cpp
diff options
context:
space:
mode:
authorGuilherme Felipe <guilhermefelipecgs@gmail.com>2018-12-23 11:06:53 -0200
committerGuilherme Felipe <guilhermefelipecgs@gmail.com>2018-12-23 18:56:18 -0200
commitbacf5124cf945dd0619d77f1b2668b02db2f2567 (patch)
tree8a51354298827528452d948012fef4226963e2fa /scene/2d/tile_map.cpp
parent10e9221c49eddc05cb36c0b582060cac9e4c8cef (diff)
downloadredot-engine-bacf5124cf945dd0619d77f1b2668b02db2f2567.tar.gz
Add EDITMODE_PRIORITY for ATLAS_TILE
When editing ATLAS_TILE, now it's possible to enable priority to randomize subtiles.
Diffstat (limited to 'scene/2d/tile_map.cpp')
-rw-r--r--scene/2d/tile_map.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 37886861e0..8c92a08224 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -906,8 +906,17 @@ void TileMap::update_cell_bitmask(int p_x, int p_y) {
_make_quadrant_dirty(Q);
} else if (tile_set->tile_get_tile_mode(id) == TileSet::SINGLE_TILE) {
+
E->get().autotile_coord_x = 0;
E->get().autotile_coord_y = 0;
+ } else if (tile_set->tile_get_tile_mode(id) == TileSet::ATLAS_TILE) {
+
+ if (tile_set->autotile_get_bitmask(id, Vector2(p_x, p_y)) == TileSet::BIND_CENTER) {
+ Vector2 coord = tile_set->atlastile_get_subtile_by_priority(id, this, Vector2(p_x, p_y));
+
+ E->get().autotile_coord_x = (int)coord.x;
+ E->get().autotile_coord_y = (int)coord.y;
+ }
}
}
}