I have confused myself (very much) with the process on identifying the cells of a tiles map inside of an area 2d. I would like to change the tile when there is contact with the object and use a surrounding area 2d to tell the cells to change to the next tile.

The best way i have seen it summed up is follows, but i am struggling on how to do this within my area 2d:
"
n 4.0, you need 3 identifiers to check a given tile:

The first one is the source ID, it corresponds to the TileSet source ID you have your tile in. This source ID is visible in the list of atlases on the left of the TileSet editor.

The second ID is the atlas coords, which correspond to the coordinates of a tile in the atlas.

The last one is the alternative ID, which only matters if you created alternative to a given tile. Otherwise, it should be 0.

To get those IDs from a tile on a TileMap, you can retrieve them using TileMap.get_cell_source_id(...), TileMap.get_cell_atlas_coords(...) and TileMap.get_cell_alternative_tile(...), and thus compare them to the expected value. Those ID are -1 (or Vector2i(-1,-1)) if the cell is empty.
"
i think i should be able to do this with my area 2d with the resources i have. However..... here i am again. Kinda need someone to strap the training wheels on here.

please anyone.... help, i cant make this work. i have read on the web (a couple examples leading here) but its just not clicking. i feel like i am missing something very simple or trying to do more than i need to. I have managed to delete the whole tilemap when the contact occurs from the area2d but it was not what i wanted to do. when i try to use the set_cell() im unsure if i am putting the correct information in. I know in 3 it was map_to_world and now its local_to_world to check cells at a given position but even then i am virgin to doing any tile map manipulation.

-I want to identify the cells of the tilemap inside the area2d and place them in an array
-then iterate over the array and set_cell() to various indices, possibly to -1 but mainly thru animations.

I'm doing trial and error to figure out most of what i need to learn, but that has limitations. if i am too stuck, i typically stroll thru "examples" in tutorial hell, but i cant find what i need anywhere. At this point i think pure frustration is keeping me from hurdling this obstacle.

EDIT:
world_to_map() is now local_to_map()

map_to_world() is now map_to_local()

how about you post script or maybe minimal project ( zip withouth the .godot folder) or script.. nobody wants to spend time reading your cries explaining stuff.. we need data, wheres the data - script, scene, node structure..

@kuligs2 Geez dude, i see where the avatar is fitting today. thanks for replying never the less. i do get what you are saying...
but if i had anything working i would post it, though it would respectively be everything else but "THIS". i have tried 5 different ways and probably a part of each time was correct but something isn't working out. so i hoped that this resource could assist, i feel like that is what forums are for.
"DATA" wise- i am asking how to identify the cells of a tilemap inside the area 2d. i think that i'm making that more difficult than it should be. put points in array(how?). iterate over points and change the cell(how?). right?
also- in what script/node/instance structure i should use to do this bc that also is most likely an issue as well.
The Godot docs are surely full of the answers but I am not getting something in how to do this. I need to see how it works or at least the structure/process. I am not getting it, and id bet it's something i need to learn more about but i do not know what to learn. that why i was hoping someone could show/explain to me how to structure it.
simplest Project structure:
Main scene- node2d: containing the scenes below.
Object--ROUND Area scene- node 2d with area2d for influencing cells, rigidbody2d to interact with level
Map--tile map- tile map node with atlas created, and physics layers set up properly, painted in the world environment
i was hoping to use the area2d to signal to the tilemap when its entered, and change the cell index based off the position. Or do i need to pass the position and world_to_map/map_to_world somehow inside a different script,
The tile map section in the docs has lived on my computer for 3 days now getting opened every 5 min i try to do this, and i haven't found a good example showing this in Godot 4, specifically the round area2d.
so yes, i need help.... 😢<(wah)

  • xyz replied to this.
    6 days later

    REVBENT You can use area's body_shape_entered signal to detect when an individual tile entered the area. Similarly, you can use body_shape_exited to detect when it left. The first argument a signal handler receives will be body_rid. Pass that to TIleMap::get_coords_for_body_rid() to get the cell coordinates.