Hey,
I’m making a litte game where you are flying through the air with an airplane.
So to make the flying effect, clouds come frome the rigth and move to the left (no problem so far).
Now I want to make the clouds a little random so for my prototype I have created 5 little clouds that should be duplicated randomly (no problem) and on a random time basis (problem).
Here is my duplication code: [SIZE=1]wolken means clouds in dutch[/SIZE]
function duplicate() {
i++;
x = Math.round(Math.random()*5);
duplicateMovieClip(wolken[x],"wolk"+i,i);
//random y-positie + buiten scherm beginnen
setProperty("wolk"+i,_y,Math.round(Math.random()*398));
setProperty("wolk"+i,_x,770);
//sleep
sleep = Math.round(Math.random()*7000) + 1000;
trace(i + " - " + sleep);
setInterval(duplicate,sleep);
}
So I thaught this function will call itself every “sleep”, so minimal 1 sec and maximal every 8 seconds.
But it doesn’t :h: it only does that the first time and after that it looks like its completely random but everytime faster and faster and eventually I have so many clouds my screen is completely white and my computer hangs…
Anyone who can help me?
Pete :p: