The built-in Lua "math.random()" function usually works fine for me. My game "Mr. BallGuy" relies on it. That's how I randomly generate the balls. But now, for some reason, the following function always generates "0" for some reason. I've checked this using love.graphics.print to print the values of the X and Y position for the platform. Here it is:
Code: Select all
objects.platforms[objects.platforms.currentPlatform].x = math.random(width - objects.platforms[objects.platforms.currentPlatform].w)
objects.platforms[objects.platforms.currentPlatform].y = math.random(height - objects.platforms[objects.platforms.currentPlatform].h)
Anyone got any ideas on what might be the issue?
Thanks!
File: https://www.dropbox.com/s/43edi26334sb9lr/Game.love