smartguy240 |
I was playing KQ3 and I noticed the squirrels and stuff that randomly appeared on the screen and I thought WOW :o ! I wish I could put that in my game! Does anyone know how to do this? :D ;) :) |
AGI1122 |
Easy, use the random command and make it so that if it generates a certain number then draw the things that need to be drawn on the screen. If you would like a more in depth explanation of this just ask. |
sonneveld |
random(n,m,k) where variable k is assigned a number between the range of n to m. So if you want to display monkeys on the screen 30% of the time.. you could do something like this: if (newroom) { random(0, 100, v100); if (v100 < 30) { //load, draw, display, animate monkeys } } - Nick |
smartguy240 | So is v100 just like saying it is this much percent or is v100 a variable ??? |
AGI1122 | useing the code above v100 will be set to a number from 0 to 100. and if v100 is less than 30 then it will animate monkeys.... I thought this was funny. :) |
Joel | yeah, to clear that up...it doesn't have to be v100...if you put v145 instead of v100 in the code above, then v145 will be set to a value between 0 and 100 |
sonneveld | sorry.. bad example |
AGI1122 | No, it was a good example, but you didn't really show him what each part did, that is why he got confused. |
sonneveld |
I meant having 100 and v100 together.. i mentioned the syntax for random at the start i thought. thanks though. - Nick |