VAR MAXX = 400 / 16 VAR MAXY = 240 / 16 VAR TREE = 107 'Dont know the right index, replace with desired tile id BGSCREEN 0, MAXX, MAXY FOR I = 0 TO 4 REPEAT X = RND(MAXX) Y = RND(MAXY) UNTIL BGGET(0, X, Y) != TREE BGPUT 0, X, Y, TREE NEXT II typed that without testing in SmileBasic, but is that what you are looking for? The repeat until loop is to make sure each tree goes on a new tile.
Placing a bunch of trees
Root / Programming Questions / [.]
Z_E_R_OCreated:
I would change tree to 100 in the example for a better tree picture but otherwise the code above just puts some tiles on the BG graphics layer.
I wasn't using arrays, RND is a function call to the random number generator. BGGET is also a function call that gets a tile id from the BG graphics layer.
If you need it in an array I would just create tree_x and tree_y empty arrays then push the values in. Instead of bgget you would have to loop through the array so far looking for a duplicate x and y location. Hope that makes sense. Let me know if you have questions.