Skip to content

Instantly share code, notes, and snippets.

@foldi
foldi / README.md
Last active September 27, 2016 09:37
FloraJS | Sheep vs. Wolves

IMPORTANT: If the simulation above does not render correctly, click 'open in a new window'.

FloraJS | Sheep vs. Wolves

This simulation uses a custom Animal class that carries a custom sensor. One group, the Sheep, carries a Wolf sensor that triggers a COWARD behavior. The other group, the Wolves, carries a Sheep sensor that triggers an AGGRESSIVE behavior.

The result... the wolves chase the sheep. To make things fair, the sheep have a 'wrapWorldEdges' property set to true. When they cross the world boundary, they cross to the other side. Wolves however bounce off the world boundary.

Play with the various properties to affect the simulation.