Adding script to a tileset tile

Godot Version

v 4.2.1

I am trying to make a game where every tile is editable, so a sandbox. I have a tileset for an example of a house, and it includes a door tile. I added a hitbox to the door, but how do I add a script to the door tile that handles the opening/closing? From searching the forums it seems like its not so easy to do, so how would I go about doing it?

Getting specific tile collisions is very tricky to do and requires extensive knowledge of the engine.

You’re probably better off making the house a Scene itself and implement all kind of interactions in its script if you don’t want to embark on a journey of pain and suffering.

An initial approach depends on how you’re interacting with the collision, but once you have this, and its position, you can replace the door tile with the open version (and vice versa), e.g. from the tilemap itself (assuming this is handling the hitbox collision).

Ok, so I need to attach a script that replaces one of the tiles of the house scene to an open door that has no collision? Where would I attach the script for it?

Thats what I did already. The house is a separate scene with two TileMaps: For the floor and for the walls. The walls have their own hitbox

What’s detecting the door? I’d lean towards a script on the tilemap itself, with methods to determine if a given collision/position is a door, and to also change the tile at a position with another tile.

The thing detecting the door can then ‘ask’ the tilemap if it is a door, and to also ‘open’ the door, if that makes sense.