
-----------------------------------
Biohazzrd
Tue Nov 28, 2006 6:19 pm

random movement like fish
-----------------------------------
for school we are making a fish tank in flash where we each make a fish and I have been entrusted with duty to program the random movement like fish do i have some code but it doesent work. Here it is:Object.prototype.move = function  () {
	rotAdd = (random(100-(vita*rot))-50)/100;
	rot += rotAdd;
	_rotation  += rot;
	posX = this.tempo * Math.sin((_rotation/180)*Math.PI);
	posY = -this.tempo * Math.cos((_rotation/180)*Math.PI);
	_x += posX;
	_y += posY; 
	if ((((_x < -20) or (_x > 550)) or (_y < -20)) or (_y > 500)) {
	    _rotation += 180;
	}
};

This is supposed to go into the first frame of the root time line and the this bit of code goes to themovie clip on the root timeline:

onClipEvent(enterFrame){
move;
}


this is supposed to be what it looks like, go to this link (http://friendsofed.infopop.net/2/OpenTopic?a=tpc&s=989094322&f=3953051263&m=6483039495) 
and go to the "fish V1" in examples in the first post
