Can I use multiple Tileset nodes and detect which one I'm standing on

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Light

So I’m attempting to make a game mechanic that lets the user do specific things when on top of different ground types (think Avatar the last air bender kind of stuff).

So the 2 questions I have are this:

  1. Can you have 2 tileset nodes in one level that don’t break when they touch each other? I tried this in a couple of different ways, but the character freaks out when moving on them. I checked the collision and the player character sometimes thinks it doesn’t have a ground underneath and sometimes it thinks it has 2 for some reason?! Example -

  2. If it is possible to have 2 tilesets in one level, how can I tell what my character is standing on? So as an example, if I’m on the ice, the fiction would be lower and because is_on_ice would be true, I could allow the use of an ice ability

Also, currently walking into walls also makes my character think it is coming off the ground so this could be a deeper issue :confused:

Thanks in advance!

You might be able to use different TileSets on different TileMaps if you have the maps use the same collision layers/masks.

Ertain | 2020-07-05 17:13

:bust_in_silhouette: Reply From: Jorge

Hi, I will try to help you.

you could try this several ways, however, to detect the tiles and have different reactionsI I would have the player with 2 raycast and each one with different properties.

regarding the layers, the first layer is what is the object and the mask is the one you want to collide, I would change the names in project setting so you can make it easier.
layer1: player, layer2: world, layer3: enemy
player :layer in player and mask in word and enemy
world : layer in world and enemy
enemy: layer in enemy and mask in player, world and in enemies if you want to collide if not I would not select it.

however the the layer isn’t necessary to select one you could unselect all and just select the mask.

I hope it make sense.

good luck