Birds for the environment on iPhone

Hi,

I am developing a game and I need simple scripts that can be used to fly birds in environment around my player.

I tried the Flocking Behavior on wiki

http://www.unifycommunity.com/wiki/index.php?title=Flocking#Download_Package

But its not for iPhone. it uses some keywords like

yield WaitForSeconds(waitTime);

that is not supported in iPhone. Could someone guide me how to use this script for iPhone or there is any script that can be used on iPhone to fly birds.

regards

thanks in advance

unityboy

…but it is? I’ve used this in a couple of projects already and it works fine.

thanks for your reply
I am using following code in my code file

function FixedUpdate()
{
	// - prints "Starting 0.0"
	// - prints "WaitAndPrint 5.0"
	// - prints "Done 5.0"
	print ("Starting " + Time.time);
	// Start function WaitAndPrint as a coroutine
	yield WaitAndPrint();
	print ("Done " + Time.time);
}

function WaitAndPrint() {
// suspend execution for 5 seconds
yield WaitForSeconds (5);
print ("WaitAndPrint "+ Time.time);
}

it gives me followig error

Script error: FixedUpdate() can not be a coroutine.

any thing I am doing wrong.

regards unityboy

You can’t use a yield statement inside of a FixedUpdate, Update, or Awake function.

Put your code with the yield statement in another function of whatever name you chose and then call that function from your Update or FixedUpdate method like this:

StartCoroutine(“MyFunction”);

(where ‘MyFunction’) is the name of the coroutine.

thanks for everyone its working now. The flocking script. Can any one tell me how to keep the birds’ face where they are flying to.

Any suggestion about it.

regards

unityboy