Pong game in vanilla js

so much vanilla that I didn’t even use the canvas api, but it turned out half decent and I hope you guys like it!

(P.s: code readability-wise it’s a bit of a mess)


1 Like

I couldn’t play in my phone unfortunately. (Or maybe I didn’t understand how to)

Sorry to hear that, not sure if the controls break on mobile, but there are two ways to play on computer: either by mouse or by arrow up/down.
What was the confusing part?

i guess i didn’t know how to play (I just tried again on my laptop). The ball just bounces in a straight line and I can’t figure out how to make it do anything else.

Oh it’s just a regular Pong game, it reflects with an angle if it hits the edge of the paddle, else it would just bounce straight back

I tested it out real quick and I noticed that the “edge of the paddle” was a very very small part of the paddle. It took me several tries before I could get the paddle lined up correctly so that the ball would hit that edge and change direction. So my advice would be to make that edge a little bigger so that it is easier to change the direction of the ball.

1 Like

You have a point, I changed the collision range a bit to be more sensitive.
I had it even less sensitive earlier in development, but I guess this is why external feedback is quite important :v:

Great game but I din’t know how to change ball direction until I read the forum comments. Perhaps add that to the instructions of the game or just add the random ball movement at the start of the game after a person clicks play that way people can start immediately start playing.

1 Like