Adding colliders to our tiles

Once we have changed the properties of the Terrain and Water layers, we now need to add colliders to our tiles. To do this, you need to:

  1. Select that tile from the Tilesets panel.
  2. Then, navigate to View | Tile Collision Editor. You should now have a screen that looks like the following screenshot:

Lastly, in the Tile Collision Editor, select the rectangle tool (as highlighted in the following screenshot), and make sure that you draw a rectangle so that it is the same size as the tile, like so:

You will have to repeat the above steps for each tile that has been used within the map that the player will collide with. In our example, this isn't an issue because we will need to add colliders onto everything. But for Tilesets which have tiles that contain decorative assets such as various plants or other environmental adorations, you won’t need to add a collider. Once you have finished adding colliders to all of the tiles, save it and open Unity.

There are many great features that Tiled offers, which we won't cover in this book. These features can help you to create more detailed and complex maps. Therefore, I encourage you to actively check out the documentation on their official website, by visiting the following link: http://doc.mapeditor.org/en/latest/.
Another place that I recommend checking out is this series of video tutorials: http://www.gamefromscratch.com/post/2015/10/14/Tiled-Map-Editor-Tutorial-Series.aspx. Even though they are a little old, they cover quite a few things about Tiled that are still relevant to the current builds.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset