Okay, I've been working on this all day, and I feel like I am getting close to a (clumbsy) solution that will work for me. First, the Capx:
dropbox.com/s/cfrpehoswcvy8vq/sheepherder.capx
What I am trying to do:
I'm trying to write a "herding" game, where you give the dog commands, it runs out and basically chases around the sheep. The sheep should stay bunched up (in a little herd) but should move away from the dog. They tend to move away as a group, but if the dog gets too close (buzzes the sheep) they will eventually split off.
Right now, I am JUST trying to get a working herd of four sheep to clump together, move together, and flee the dog. I have them clumping (sort of) around the "ram" object and following the ram, and the ram is supposed to be fleeing the dog.
Preferably, the ram would move away from the dog more or less directly away. IE: if the dog runs to the right at the sheep, the sheep run away right. If the dog runs right and up from below and left, the sheep should run right and up as well.
Basically, the sheep need to avoid the dog. I can get them to FOLLOW the dog all day long using "Set angle toward dog.X,dog.Y" and a setting a speed, but inverting the equation with "Set angle toward -dog.X,-dog.Y" causes the sheep to run in the same direction every time.
I tried the Boids flocking behavior addon earlier this evening, and ran into problems with that, also. The sheep wound up stacking on top of one another, or when I finally got them to behave like solid objects would push the ram all over the screen, then also they blocked the ram from moving if the dog got close.
Any assistance or suggestions on this would be helpful.