This is what I used recently. See attached image.
The animations 'Closed' and 'Open' not only differ visually, but the closed one has a collision shape, while the open one doesn't.
You change the values in the 'if' statement to your own needs. You can also change the 'less than' to greater than to change the direction that you want to block.