MegaMente Br
Here's the tuto code.tutsplus.com/how-to-use-tile-bitmasking-to-auto-tile-your-level-layouts--cms-25673t
I've implemented 8directional version.
This is the code to put in to BIT variable I'm using for my project, but you will have to customise it cause I'm using variables. It checks if the tile at xy is same as the current tile, and if so it ads a number.
varTileType = (Tilemap.TileAt(x, y)
((Tilemap.TileAt(x+1, y) = TileType)*16) +( (Tilemap.TileAt(x, y +1) = TileType)*64 )+ ((Tilemap.TileAt(x-1,y ) = TileType)*8 )+ ( (Tilemap.TileAt(x,y -1) = TileType)*2) + ( (Tilemap.TileAt(x+1, y+1) = TileType)*128 * ((Tilemap.TileAt(x+1, y) = TileType)) *((Tilemap.TileAt(x, y+1) = TileType)) )+( (Tilemap.TileAt(x-1, y +1) = TileType)*32 *((Tilemap.TileAt(x,y+1) = TileType)) *((Tilemap.TileAt(x-1, y) = TileType)) )+( (Tilemap.TileAt(x-1, y -1) = TileType)*1*((Tilemap.TileAt(x-1, y) = TileType))*((Tilemap.TileAt(x, y-1) = TileType)) ) + ( (Tilemap.TileAt(x+1,y-1) = TileType)*4*((Tilemap.TileAt(x, y-1) = TileType)) *((Tilemap.TileAt(x+1, y) = TileType)) )
Then you need to create array with 256 cells. Each cell coresponding to the table below should have a tile number.
( first number is the array cell column and second number is the tile number )
{ 2 = 1, 8 = 2, 10 = 3, 11 = 4, 16 = 5, 18 = 6, 22 = 7, 24 = 8, 26 = 9, 27 = 10, 30 = 11, 31 = 12, 64 = 13, 66 = 14, 72 = 15, 74 = 16, 75 = 17, 80 = 18, 82 = 19, 86 = 20, 88 = 21, 90 = 22, 91 = 23, 94 = 24, 95 = 25, 104 = 26, 106 = 27, 107 = 28, 120 = 29, 122 = 30, 123 = 31, 126 = 32, 127 = 33, 208 = 34, 210 = 35, 214 = 36, 216 = 37, 218 = 38, 219 = 39, 222 = 40, 223 = 41, 248 = 42, 250 = 43, 251 = 44, 254 = 45, 255 = 46, 0 = 47 }
Then all you have to do is to have appropriately placed tiles on the tilemap's tileset.