• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - IDE Tile Set collision definition?



What's the intended/optimal method for defining collision masks when working with tile sets? In 1.x, I've seen people use a unique object and just put it everywhere they want something to be solid, and I've also seen people manually modify the collision masks for individual sprites. While both of these things still seem possible in GMS2, I assume there must be a method for delineating individual collision masks for each element of a tile set. Right? But I can't seem to figure out what that method is :/


nobody important
GMC Elder
Tiles are rectangular and have no collision mask. They also don't (currently) collide with anything. But you can use GML code to work out collision very quickly - look at the 2 demos.


tilemap_get_at_pixel(...), tilemap_get_cell_x_at_pixel(...) and tilemap_get_cell_y_at_pixel(...) are you friends :)

Soon as I found those functions it was dead easy to work out rectangular collisions, and what tile you're colliding with.