Log In  

Hi all!

I've completed a very basic implementation of Pong.

I would like to make it nicer adding a classic mode that looks and plays as close to the original as possible.

To do so I'd need, for starters, to increase my paddles speed but when I do so the paddles end out of the screen.

I cannot understand why, this is the code causing the issue, it is very simple:

 -- check if pad goes out of the upper part of the screen
  if button_up and pad.y > game.upper_bound then
  elseif button_up and pad.y <= game.upper_bound then
 -- check if paddle goes out of the bottom parte of the screen
  if button_down and pad.y + pad.h < game.lower_bound then
  elseif button_down and pad.y + pad.h > game.lower_bound then

If instead of using 1 I use 2 or more the paddles get out of bounds (or start shaking).

In case you want to check the complete code you can find it here:

P#43428 2017-08-19 13:48 ( Edited 2017-08-21 07:40)

:: jeb

I think all you need to do is to change this,


to this,

P#43431 2017-08-19 14:48 ( Edited 2017-08-19 18:48)
:: ltpitt

I am blind! :D

Really thanks :)

P#43505 2017-08-21 03:40 ( Edited 2017-08-21 07:40)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-03-30 14:41 | 0.010s | 2097k | Q:13