Locked doors in tile map

Godot Version

Godot-4

Question

I’m working on a top down 2d adventure game and I need a way to lock and unlock doors. currently my world is built with tiles, so ideally I’d like a way for my player node to interact with tiles. I’m thinking something like an area 2d that can trigger when it enters a locked door and if you have a key the tile changes to be unlocked. is there a way to do this in tile maps? I’m pretty new to Godot so I’m sorry if this is an obvious solution.

I don’t think it is possible to attach a script to a specific tile, since a tile map is basically only a big sprite made out of smaller sprites and a big collision object.

What you can do is setting specific tiles with the set_cell method or creating a new object acting like a door and placing the object like a tile in the world.

alright, thanks