Make objects appear in random locations

I was hoping to be able to do this somehow with the Edit Object > Add Object logic brick but I can’t seem to find a way to pull it off. What I want to do is when I use the Add Object function, I don’t want the object added in the same place every time, I want it to be placed randomly within preset boundary’s. IE: place the object somewhere between 1 and -1 on the X and Y, and set the Z to 0. I figured it might have to be scripted but I can’t figure out how to set the location and have it actually change in the GE. Any ideas?

-Heba

You can use a little script to move the spawner to a random X and Y, derived from the random.uniform function.

Example is attached.

Attachments

random_spawn.blend (424 KB)

thanks it works fine as i wanted