Your sentence "a hedgehog curls into a prickly ball when in danger." is almost perfect! Here's a quick grammar tip: the first letter in a sentence should always be capitalized.
So, the correct version is: "A hedgehog curls into a prickly ball when in danger."
Great job!