merge 2 autotiles

boruokboruok Posts: 14Member

It's possible to merge 2 autotile into one?
what i see:

what i want:

Tags :


  • 2DFanatic2DFanatic Posts: 2Member

    The tile you want as the result of the 2 separate tiles above has a completely different mid section. The merging between tiles should be relatable like using bit-mask for mapping what tile must appear next to another tile while auto tile mapping. I recommend you watch this video for using the tile-set editor :
    And this for setting rules for tiles during map generation.

  • tmctmc Posts: 1Member
    edited March 10

    This is accomplished by attaching a script to the TileSet which overrides the undocumented _is_tile_bound() virtual method. This method is called (at least) 8 times for each tile, with each of the neighbouring tile IDs, and should return whether those two tiles are considered to be part of the same group of tiles or not.

    It turns out that adding this overload only makes autotiling about 10-20% slower, because it's slow anyway.


    extends TileSet
    # "tool" makes this also apply when placing tiles by hand in the tilemap editor too.
    const BRIDGE = 4
    const BRICKS = 5
    const CHASM = 6
    var binds = {
        CHASM: [BRIDGE],
        BRIDGE: [BRICKS],
        BRICKS: [BRIDGE],
    func _is_tile_bound(id, neighbour_id):
        if id in binds:
            return neighbour_id in binds[id]
        return false

    Just chasm tiles:

    Bridge tiles added. Note that the bridge affects the chasm autotiling but not vice-versa.

    Brick ground tiles added. Note that the brick and bridge tiles join together.

  • boruokboruok Posts: 14Member
    edited March 16

    I really appreciate your help. Thank you.

  • boruokboruok Posts: 14Member
    edited March 26

    also, if you whant to merge all your AutoTiles in same TileMap, you can use following code:

    extends TileSet
    func _is_tile_bound(id, neighbour_id):
        return neighbour_id in get_tiles_ids()

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file