I am making a startup code for my birds to fly over the screen. My problem is this:
I want to be able to randomly let the birds appeare on the screen, at the same place as the other bird was before but not with the same time between them. As it is now the birds comes out on the screen every 7 seconds.
I have tried
sleep(7) + random(100);
and
sleep(7 + random(100));
but none of these did the trick.
I want them to come not regular...if you get my drift..I have marked with red where I tried it.
What am I doing wrong? The code works fine, only need to do what I asked with it.
Does anyone know a solution to my problem?
Code:
function lag_fugler6back_startup()//blue bird oppsite way
{
sleep (7); // wait until the level is loaded
while (1)
{
temp.x =500; //original -1000
temp.y = -400 ;//+ random (3000);//original 1000
temp.z = -250;//+ random (500); //original 500
ent_create (crow_mdl, temp.x,flytt3_fugl_motsattvei);
sleep (7); // generate a birds <-- I want to change this?
}
}