“There are certain rules that one must abide by in order to successfully survive a horror movie,” Randy told us in Scream. “For instance, Number One: You can never have sex. Sex equals death, OK?”

He’s right. For some reason, sex often draws out slasher movie villains, and when supporting characters hook up, they often also get chopped up. The connection between sex and death isn’t just a horror movie trope, though. Biologists have often suggested that animals are at a higher risk for getting killed and eaten during mating, either because they’re more conspicuous, less vigilant, or can’t escape as fast.

For flies, it’s that first factor that’s the problem. Mating can mean certain doom because the sounds they make catch the attention of a killer lurking in the shadows.

In Europe, Natterer’s bats (Myotis nattereri) often roost in barns and cow sheds, drawn by flies that are attracted to animal manure. There’s plenty to eat, but catching the flies isn’t easy. Natterer’s bats hunt by echolocation, generating ultrasonic calls and using the echoes that bounce back to find prey and map their surroundings. Inside the farm buildings, finding flies this way is “almost impossible,” says biologist Stefan Greif, because the faint echoes made by the flies are masked by the more massive ones bouncing back from the walls and ceilings. What’s more, the flies also stop flying around at night, when the bats hunt, and either move around by walking or sit still on the ceiling, making them even harder find.

Over four years, Greif and his team of researchers filmed thousands of flies walking along the ceiling of a cow shed in Weitershausen, Germany that was home to a colony of 45 bats. In all that time, not one of them was attacked by a bat. Yet, the bats stayed, and Greif knew that flies made up the majority of the species’ diet. So how were they catching bugs that were all but invisible to them?

It turns out that the bats are a little bit like B-movie killers, and make their attacks when the flies are having sex. While flies just walking around were inconspicuous, Greif found that ones that were getting it on were a clear sonic target. This is because when flies mate, the males flutter their wings, producing a burst of click-like noises. Humans can hear the lower frequency noises as a soft buzz, while the higher ones ring as loud and clear to the bats as a dinner bell. More than a quarter of the mating flies that Greif caught on camera during the study were attacked by the bats, and more than half of those attacks were successful, with the bat devouring both flies in all but two cases.

To make sure that it was the sounds of sex that got the bats’ attention, the researchers tried two experiments. First, they stuck dead flies together in mating positions and mounted them on the ceiling. These were ignored by the bats, so it isn’t the bigger target and larger echo that mating flies create that gives them away. When the scientists recorded the flies’ mating sounds in the second experiment and played them back over a sound system, though, the bats went on the hunt. The researchers watched as “the bats approached, hovered and inspected the speaker, and in several cases tried to glean the acoustically simulated flies from the speaker with their tail membrane—just as they did with real pairs of copulating flies on the ceiling.”