Posted By: Marwan
random code - 07/06/08 23:26
wussup george , I copied a randomization code from your aum from the questions section , i dont remember which one , and i modified it and made it like this
it was for saving quotes in a random way , i only changed the instructions
the question is , whats the use of the index var , I replaced it with while loop , but it screwed it up
the other question is that i cant see any randomization , because i watched the pan variable of the entity and it only keeps increasing , it dont decrease at all , and vice versa with the tilt variable , it only keeps decreasing
and sorry for bothering you george
Code:
function bat_direction() { var index; index = random(10); var tempo = 0; while (index > 0) { tempo = random (1); if (tempo <= 0.2) { my.pan+=0*time_step; } if ((tempo > 0.2) && (random(1)<= 0.4)) { my.pan+=10*time_step; } if ((tempo > 0.4) && (random(1) <= 0.6)) { my.pan-=10*time_step; } if ((tempo > 0.6) && (random(1)<= 0.8)) { my.tilt+=10*time_step; } if (tempo > 0.8) { my.tilt-=10*time_step; } index-=1; } }
it was for saving quotes in a random way , i only changed the instructions
the question is , whats the use of the index var , I replaced it with while loop , but it screwed it up
the other question is that i cant see any randomization , because i watched the pan variable of the entity and it only keeps increasing , it dont decrease at all , and vice versa with the tilt variable , it only keeps decreasing
and sorry for bothering you george