If you are a tadpole, sometimes it pays to watch out for headhunters. That’s because the wriggler next to you may be a cannibal — and you could be its next meal.

As NATURE’s The Body Changers shows, some animals can undergo dramatic transformations when food or living space becomes scarce. The tadpoles of some toads and frogs, for instance, can morph from placid plant eaters to fierce cannibals if their pools threaten to run dry. By becoming meat eaters that snack on other tadpoles, the cannibals speed up their development, hoping to transform into toads before the water runs out.

Tadpoles can become cannibalistic.

Spadefoot toads, for example, live in dry areas. Adults wait to lay their eggs until temporary pools are formed by infrequent rainstorms. Though the tadpoles take only two weeks to develop into toads, sometimes the pools don’t last that long. The tadpoles get a tip that the pools are shrinking when they start bumping into each other and fairy shrimp, insect-like animals that also thrive in puddles. If a tadpole eats one of the shrimp, it can spark a transformation into a full-fledged cannibal.

Even the cannibals can be somewhat careful about their diets, however, as researcher David Pfennig of North Carolina State University has shown. In some species, the cannibals generally avoid eating their brothers and sisters, preferring to eat unrelated tadpoles instead. Exactly how they tell the difference between friend and foe isn’t known.

Tadpoles can also undergo other types of changes when conditions change. Some, for instance, change color and start producing a distasteful chemical when one of their friends is munched by a predator. The dying tadpole releases chemicals that warn other tadpoles that a predator is nearby. Within hours or days, nearby tadpoles turn bright colors, which, like a living billboard, warn predators that they don’t taste very good. It’s a change that helps ensure their survival.