0 votes

I have a class inherited from TileSet and am trying to implement the forwardsubtile_selection method. For the most part I am trying to imitate the way the engine performs subtile selection but with a few modifications. I'm looking at the engine code, specifically TileSet::autotilegetsubtileforbitmask.

That method iterates through the subtiles using this loop:

for (Map<Vector2, uint32_t>::Element *E = tile_map[p_id].autotile_data.flags.front(); E; E = E->next())

(See tile_set.cpp line 639 on branch 3.2)

I'm trying to find a way to similarly iterate through the subtiles, but they don't appear to be exposed to GDScript. It DOES provide the method TileSet.autotilegetbitmask, and I've considered manually incrementing a Vector2 and using that method to get the bitmask from each subtile, but then my problem is that I can't find any method which provides me with the bounds of the autotile on the tileset in order to iterate within.

Is there something obvious that I'm missing? It seems very difficult to implement a method to select a subtile without there being access to the subtiles.

I'd like, if possible, to be able to do this without needing to modify the engine or to create a plugin or module.

Thanks for any help!

asked Apr 10 in Engine by awardell (12 points)

but then my problem is that I can't find any method which provides me with the bounds of the autotile on the tileset in order to iterate within.

So you're looking for the dimensions in x- and y-direction of the autotile-atlas? If so, check out my answer over here.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.