Pong in javascript [Solve] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Pong in javascript [Solve]

Hi everyone, can you all try to help me pls. I'm trying to code the classic game pong but i don't know how to code the ball. My oll code(In another IDE the functions moveTopJ1, moveBottomJ1, moveTopJ2, moveBottomJ2 works): https://code.sololearn.com/Wf5BpOL5z92z/#html

15th Mar 2020, 9:10 PM
AlexRos
AlexRos - avatar
5 Answers
+ 5
AlexRos Share the code. It doesn't matter if it doesn't work here. We need more info. Your loop variable is always 1(infinite loop).
15th Mar 2020, 10:47 PM
Kevin ★
+ 3
I am not familiar with js but as far as I can see moveBall is a function. So I guess you need to call this function. Btw: what is velocidad2? I can't see that you define this variable.
15th Mar 2020, 9:24 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
And where do you define ball? Maybe it is better to add your complete code in code playground (webcode -> js) and to share the link here.
15th Mar 2020, 9:33 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
sorry velocidad2 is equal to 100 and it is call in the keyCode 67 in a Switch loop
15th Mar 2020, 9:27 PM
AlexRos
AlexRos - avatar
+ 1
In the sololearn playground there are things that don’t work but in a real IDE with google works
15th Mar 2020, 9:58 PM
AlexRos
AlexRos - avatar