15. Power of the Weak
Standards: 2‐AP‐12: Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals
You watch as the collective breeze from the butterfly wings and the flashing colors produced by their fluttering effectively repel the boar family, who amble off, grunting discontentedly, back into the forest. You can even feel the draft ruffle your hair. Small as they are, together the butterflies wield surprising force! The Guide breathes a sigh of relief as the butterflies slow their flapping wings and start to disperse.
“I feel like the real drama of that scene isn't quite captured in your current model,” says the Guide, coming out from behind the tree. “What if you could make the world behave more like it does in the forest, where prowlers are repelled by the butterflies?”
You think this might be possible, but you'll need to incorporate some more elements into your environment, notably a physics engine that can handle collisions so that if a prowler approaches the petrified wood too closely, it is repelled by the fluttering butterfly battalion. It seems like an interesting challenge, so you get to work.
Do Some Research
Most games and many virtual worlds incorporate “physics libraries,” which help handle collisions, shoot projectiles, make items bounce off hard surfaces, and even control gravity settings so that items fall quickly or slowly. These libraries can also control the velocity of objects as they ...
Get Computer Science for Kids now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.