Actually, I just figured out a really simple way of doing this.
function moveInsect(nameOfIns, origX, origY, speedIns)
{
if (nameOfIns._x<origX-100) {
nameOfIns._rotation = random(180);
speedIns += -10+random(25);
} else if (nameOfIns._x>origX+100) {
speedIns += -10+random(25);
nameOfIns._rotation = random(180)*-1;
} else if (nameOfIns._y<origY-100) {
nameOfIns._rotation = 90+random(180);
speedIns += -10+random(25);
} else if (nameOfIns._y>origY+100) {
nameOfIns._rotation = (270+random(180));
speedIns += -10+random(25);
}
if (speedIns>40) {
speedIns = 15;
}
nameOfIns._x += speedIns*Math.sin(nameOfIns._rotation*Ma th.PI/180);
nameOfIns._y += -speedIns*Math.cos(nameOfIns._rotation*M ath.PI/180);
}
this way, all you I do is make the speed rotation random and it does the rest. The link you gave me was packed with too much code for something I just wanted to be in the background. But Thanks :)