Here are the three random movement types I used for Herd:
First off, straight path with random rotate at random intervals
onClipEvent(load){
spd=5;
shcd=0;
omg= 1;
}
onClipEvent(enterFrame){
mY = (spd*Math.cos (Math.PI/180*_rotation));
mX = (spd*Math.sin (Math.PI/180*_rotation));
if (_rotation>180) {
_y += mY; _x -= mX;
} else {
_y -= mY; _x += mX;
}
shcd++;
if (shcd>=omg) {
_rotation = random(360);
shcd = 0;
omg = random(20)+15;
}
}
Second, a 'weaving movement' created by changing the rotation to positive or negative at random intervals.
I used this for the hanggliders
onClipEvent(load){
spd=5;
shcd=0;
omg= 1;
blim=0;
}
onClipEvent(enterFrame){
mY = (spd*Math.cos (Math.PI/180*_rotation));
mX = (spd*Math.sin (Math.PI/180*_rotation));
if (_rotation>180) {
_y += mY; _x -= mX;
} else {
_y -= mY; _x += mX;
}
shcd++;
if (shcd>=omg) {
if (blim) {
blim = 0;
shcd = 0;
omg = random(20)+15;
} else {
blim = 1;
shcd = 0;
omg = random(20)+15;
}
}
if (blim) {
_rotation += 4;
} else {
_rotation -= 4;
}
}
Finally, a random jittery movement I used for the sheep:
onClipEvent(load){
spd=5;
}
onClipEvent(enterFrame){
mY = (spd*Math.cos (Math.PI/180*_rotation));
mX = (spd*Math.sin (Math.PI/180*_rotation));
if (_rotation>180) {
_y += mY; _x -= mX;
} else {
_y -= mY; _x += mX;
}
_rotation += random(60)-30;
}
All of these will require some extra code to prevent your MC from going off-stage.