class_name DoorZone extends DropZone ## A DropZone that opens a door by erasing tiles from a TileMapLayer when the ## player delivers the matching key. ## The TileMapLayer that contains the door tile(s) to erase. @export var door_tilemap: TileMapLayer ## Tile coordinates (in tilemap space) of the door cells to erase. @export var door_cells: Array[Vector2i] = [] func deliver(item: Collectable) -> void: if not accepts(item): return # Remove the door tiles from the TileMapLayer if door_tilemap: for cell in door_cells: door_tilemap.erase_cell(cell) # Consume the key (hide it instead of placing it at the drop offset) delivered = true item.reparent(self) item.visible = false item.mark_delivered() GameManager.complete_task(required_item_id) _update_marker()