Hi guys!
I was trying to make a simple pong game. The paddles bounce the ball at a random velocity and when the ball reaches a certain y axis on either side then the console prints “win” and clicking the screen restarts the game. Whenever a paddle hits a ball, the console prints “paddle1” or “paddle2”.
I was expecting that the pong game would have a perfect restart because all the objects were still on the screen, but I noticed that the ball would suddenly spaz out at seemingly random times and it would register paddle1 or paddle2 on the console.
On the third restart of the game, after waiting a while, the ball started moving even before the user clicks the screen. The ball’s random movement becomes much more apparent and more entries of paddle1 and paddle2 appear on the console. I don’t understand how there could be “ghost paddles” at random places in the screen.
After every retry, the ball would become crazier and crazier. It’s probably something about my wonky code or some misplaced code in the storyboard, but after spending half my day trying to get the game to properly restart, I still can’t find the answer.
All in all, the game’s really unstable and some feedback would be appreciated. This is my first program in CoronaSDK/Lua and I just recently got into programming/development (as in 2 days). Thanks.
P.S. Attached is the zip containing the files.
**EDIT**
I forgot to say how you control the paddles!
Click to the left corner to move the paddle to the left and the right corner to move the paddle to the right.