ive been coding for somewhat a while i thought i was turning into a good coder but once again lack of knowledge hit me in the back of my head
anyways i cant get my codes to work my question to you:
"How do i make grass spawn and randomly have or not have a tree on it?"
basicly just how do i make a tree randomly spawn on grass
ID:155182
Aug 22 2011, 6:20 pm
|
|
Aug 22 2011, 7:17 pm
|
|
You can try a for() loop and then have a rand() with like... a random chance(1/10 depending how big your map is) for a new Tree on G.
|
In response to Kenny84
|
|
Or he could just spawn them randomly in the turf's New() proc, without running the additional loop.
Also, that code is kind of redundant in a lot of places. turf/grass |
In response to Robertbanks2
|
|
You can use prob(10) to roll for a 10% chance. No need to use rand() like that. (rand() can be used for this purpose of course, but prob() is a bit more straight-forward when reading over the code)
|
In response to Robertbanks2
|
|
Robertbanks2 wrote:
Or he could just spawn them randomly in the turf's New() proc, without running the additional loop. > Welp, I guess I get a bit of help on learning too ^^ I should have thought of that, though :/ |
In response to Robertbanks2
|
|
thanks for the help :)
|