In my game, a flat wall is (supposed to be) generated randomly on app start. I got the flat wall part figured out #:-S but it generates the same coordinates every time. :-? The code I used to generate the random coordinates is:
realx = math.random (0, screenW)
realy = math.random (0, screenH)
I call the function to create the wall in the scene:init function, and that is the same function where I create the random values realx and realy. The code for calling my function that creates the wall (scene:wall) is below:
self:wall(realx,realy)
My complete project is attached if there is any code you need to look at that I didn't show in my question. Thanks!
Comments
math.randomseed(os.clock())
That's just the time the program has been running. You might experiment with different timers until you get the result you're looking for. os.timer() might be a good one to try as well.
Likes: Zizanyman
http://giderosmobile.com/forum/discussion/1071/did-you-notice-math-random-always-produce-equal-sequences-of-numbers-on-ios/p1
Likes: FlimFlamboyant, Zizanyman
Likes: Zizanyman