No problem, here's a quick example.
drive.google.com/file/d/1aA8BgPh9VGMuIjVko1eVC5zye1leriks/view
The 'enemy' sprite will pace left to right and if it overlaps with the 'player' sprite, while the player sprite's 'hidden' variable is at 0 it will destroy the sprite (you can replace that action with any animation you may want to add)
The player sprite can be moved left or right with A & D on the keyboard, and when the player sprite is overlapping the 'bed' sprite and W is pressed, the 'player' sprite will set it's position to the 'bed' sprite and go to the bottom of the layer, physically hiding it from site. It also changed the 'hidden' variable to 1, so if the enemy sprite now overlaps it, it won't trigger the destroy action.
Pressing W again, triggers another action that reverses the hiding. Again you can replace these action with whatever animation you have in mind, it is just the action of changing the 'hidden' variable to 1 that matters.