Godot Version
4.3 stable
Question
I am trying to make a dungeon generator with a tilemap and pre-made scenes, and i don’t know how to insert those scenes to my tileset trough code
4.3 stable
I am trying to make a dungeon generator with a tilemap and pre-made scenes, and i don’t know how to insert those scenes to my tileset trough code
Every image you added as a tile sheet is a source with an id
, and the tiles in it have two kinds:
atlas_coords: Vector2i
.alternative_tile: int
.The scene collections are actually sources just like the images, and the scene tiles are alternative tiles.
I had already solved it, but still thanks
View it if you wish on itch.io.
This is my solution for a level editor. The main thought is the Cell
resources with is
checks.
Cell extends Resource
|
+ - CellTile
| |
| + - source_id
| |
| + - atlas_coord
| |
| + - alternative_tile
|
+ - CellTerrain
|
+ - terrain_set
|
+ - terrain
The graph above describes the inheritance structure. You can easily write if
branches, such as:
# I did this in my code, in the image at the top
if selected_cell is CellTile:
map.set_tile(...)
elif selected_cell is CellTerain:
map.set_terrain_connect(...)