How can I destroy specific tile on tilemaplayer when character body hits it

Godot Version

4.7

Question

I was making a breakout clone and I wanted to try using tilemaplayer for my bricks.

How can i destroy the brick the ball hits? I read the documentation a bit, but got a bit confused with the local to map or get cords for body RID.

My ball is a characterbody2d and the bricks are in a tilemaplayer.

You could add scenes to a tilemaplayer. In that case, just save each tile type separately and you will be able to use ready made scenes as tiles, with scripts, collision shape and everything else attached. If you want to add stuff like a tile giving double point, duplicating the ball, destroying the ball, exploding or whatever, this solution will probably be easier in the long run.

If you just want them to get destroyed, just follow a tutorial on converting position to tile, and if not after the first tutorial, you’ll understand how it works after the second.

I read the docs a little more and watched some tutorials i think I can use move and collide to get collision data to turn into the position of the tiles, I’ll try doing that and if it works I’ll post the code here if it’s useful for someone else