How to Detect what Tile I am standing on

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

So I am trying to make a game where there are different biomes you can explore. I want to store which biome I am currently in by storing it in a variable, I thought I could do this by detecting what tile I am standing on (since each biome has its own tiles), it’s important to note that I am using auto tiling not normal single tiling do I don’t think IDS work. If you have a better Idea on detecting what biome I’m in, please share.

Ps. This is a 2d topdown pixel art game

Thank You. :slight_smile:

:bust_in_silhouette: Reply From: kidscancode

TileMap.get_cellv() will get the id of the tile you’re standing on, but as you said the id doesn’t help when you’re using autotile - the id will always be the same.

That’s why TileMap.get_cell_autotile_coord() exists.

Returns the coordinate (subtile column and row) of the autotile variation in the tileset. Returns a zero vector if the cell doesn’t have autotiling.

Using this, you can figure out which autotile cell you’re on.

This would work but unfortunately, I’m doing a procedurally generated world so doing this would always give me a random value

ChristianoBishoy | 2021-05-18 05:46

How would you get the texture of the subtile?

Karl Marx | 2023-04-24 06:32

:bust_in_silhouette: Reply From: scrubswithnosleeves

From Rungeon (YouTube):

“When u procedurally generate a level with tilemap, u use TileID to place the tiles, I’ve done this recently. And I also have it so if you click on a block you manipulate it (based on that tileID)”