tilemap connection

so im making a game that have tilemap connection like mouse adventure by @richard
does anyone know how to make this?

Check out the sample I made using the tilemaps extension here: