Making a TileLayer impassable?

Hello, I am trying to learn TIled to support a tile based game I am making in C# and MonoGame.

The map I have made is an island of various tiles. There are lots of different tiles, and some tiles are mountains, some are water. I’d like to make mountains and water impassable.

What I did was to create new tile Layers: one called HighMountains, one called DeepWater, and the basic map. I used the Select Same Tile tool to cut and paste the right tiles on the right layers (very handy!)

Now, the map is loaded into my C# program and I can move around. I got as far as:

TiledMapTileLayer allWater = myMap.GetLayer<TiledMapTileLayer>("DeepWater");

This line loads fine. Just would wonder on any suggestions to make this layer something the player could not walk over. I think if it was an array of tiles, I could figure it out. But TileLayers in this are new to me.

Thanks, and so far I seem to be able to figure out most things with a few days of beating my head against it.

You’ll probably want to use the following function to get the tile at the player’s position (or the position he wants to move towards) and check if it’s a tile he should be colliding with:

Note that apart from moving your tileset to specific layers, you could also set a custom property on your tiles to specify which ones are impassable.

First, thank you! Before I tried Tiler, I set up an array of all tiles for the map with ID, tile#, passable boolean, and other features settings. Trying to make the leap to tiler, so this info and the link are a big help.