Best way for Diagonal Colision?

Hello everyone,

I’ve been using Tiled to make my frist 2d platformer and i have a doubt…

My game has spikes. Simply put, i want to crease a colision to those spikes that are diagonal, so the character dies only when he touches the spike itself and not the square tile in which the spike is on.

For now, i am creating a object layer and using multiple triangles, thus creating multiple objects with different ID’s. So far, i did not succeed in merging the objects into one and do not know if it’s even possible.

One solution i can think of, but not sure if it works, it’s to create a Polyline outlining all groups of spikes, thus lowering the number of objects and objects ID’s i’ll have to deal with… But ideally i would like to know if there’s a way to have multiple objects ( The previously mentioned triangle objects ) using the same ID.

I looked for a question similar to this but could not find, so i apologize if i missed it. And thanks in advance!

One way to solve this would be to use the collision editor. This way you can basically assign objects to a tile. Then you can simply stamp out the tile as often as you want and get all the objects added “automatically” (well you have an association from the tile id to the objects placed in the collision editor).

But as usual this all heavily depends on your engine, your taste, …

Regards,
Ablu