Setting Tile Collision Shapes
by Jon (Updated on 2014-01-27)
- Setting the Collision Shape
- Custom Collision Shapes
Tiles can take on more than just square shapes or blank areas. You can define different kinds of boxes, slopes (triangles) or even arbitrary polygons.
Setting the Collision Shape
Suppose that we want to set the collision shape for the tile selected below. It's a sloped tile at about a 60 degree grade.
1) To set the collision shape, go over to the Collision Bounds window, scroll using the scroll bars to find the shape you need, and click on it.
2) Save your Tileset to confirm the changes.
Custom Collision Shapes
Sometimes you will need a custom collision shape for a tile that isn't reflected in any of the standard shapes we provide.
If this is the case, you can define a Custom Collision Shape by clicking on the + button. You can create either a Box or a Polygon.
X and Y dictate the relative position of the box, in case you want it to be shifted off the origin (0,0).
All values are in percentages (0 - 100 inclusive). We do this, so that you don't have to worry about how big the tiles are.
Create a Polygon by defining points and setting their x,y values, either through the table or through drag and drop. A polygon must have 3 or more points but no more than 12.