Can someone help me

can someone assist me with a nonfunctional code


edit:it will get stuck behind the top paddle
practice is the only mode that works

Hi @j214449,

That’s a pretty neat game. Can you describe what exactly is supposed to happen in the practice mode? It looks like I’m able to control both paddles simultaneously and that the ball bounces off the paddle as well as the top edge of the screen. Logically, it seems that the game is doing what you intended - it really depends on what is the exact behavior you want. If you want the ball to bounce off both the top paddle as well as the top edge of the screen, that’s exactly what’s happening when the ball gets “stuck” at the top - it’s bouncing between the top paddle and top edge.

Frank

1 Like

Hi Frank, i’m attempting to fix the glitch were the ball get stuck bouncing at the top of the screen. I would like it to bounce of the bottom of the top paddle and come back down thanks in advance.

Jack

Hi Jack,

It looks like you got it to bounce off the top paddle. However, what would you like to happen when the ball goes upward and gets past the top paddle?

If in that case you want the ball to bounce back down, is there a purpose to the top paddle in your practice mode? You might consider just removing the top paddle. That would make the game pretty much like practicing tennis against a wall in real life.

Frank

Hi Frank
My student has made a mistake with the names. He eventuality wants to make practice a real game mode and delete the 1v1. The goal is to get it to bounce off of the top paddle back down and have them moving separately in the end but he needs help with the bounce of the top paddle and i cannot find the error thanks in advance.

Jack

Hi Jack,

The program seems to have changed entirely, so I can’t comment on exact code. However, from what I remember, the ball bounced off the top paddle just fine. The problem was that the ball also bounced off the top edge. When the ball got “stuck”, what was happening was the ball bounced off the top edge of the screen, then bounced back and forth as it was sandwiched between the top edge of the screen and the top edge of the top paddle.

The student needs to change the code so when the ball touches the top edge of the screen, the player wins (or the ball resets, or something other than bouncing back down).

Frank