Hi!
I’m brand new on Defold, also on Lua, I lookup the forums and other tutorials to try to do so but was unsucessful.
My main goal was to make my Sprite.Image changes when my Llama walk in the water tile, could really find a way to do it with the tiles, I just added a collision box with the Trigger property.
Here is way I’ve done by now.
Added the collision box to my character, 1st problem (I can’t put Dynamic because it needs a mass and breaks my top-down moving system.)
Here’s how you define collision groups in your tilesource. First you select your tileset as the collision file (or you can use any image with transparency as long as the tiles are at the same spot as what they are supposed to represent in terms of collision), then you can select and paint the groups into your tiles. So in this image I have the ground as default collision group and water as water collision group.
Then on the GO you added your tilemap to you create a collisionobject and set its shape to the tilesource. You will also want to make sure you set the mask to what you need, the group will be set by what you have in the tilesource.
You can of course use layers too if you want to have some collision groups not associated with tile images but want to be able to paint freely you would use a transparent tile along with a solid (or whatever shape) collision image pair. There are other solutions too.
Is your character kinematic? You need to make sure you are colliding with the correct groups only. Check the group of the other and you should be able to tell the difference between walls and water.
I forgot that you can hide layers. Hidden layers will also not be drawn when the engine is running, but their collision groups will still be used. So you can use symbols to define areas too with this.