Back to Snippets

Classic Retro Ping Pong Game (HTML, CSS, JS)

Pong, rebuilt with a canvas element and a requestAnimationFrame loop. Arrow keys move your paddle and the computer plays the other side.

The AI is deliberately basic. It tracks the ball's vertical position and moves toward it at a fixed speed, which leaves it beatable. Raising that speed value is the quickest way to make the game harder.

Collisions are axis-aligned box checks. Where the ball hits the paddle changes its outgoing angle, so returns are not all flat reflections. The retro look comes from Press Start 2P, with a system font fallback if it fails to load.

707
#javascript
#html
#css
#ping pong game
#retro game
#arcade game
#classic game
#2d game
#canvas game
#paddle ball
#online game
#browser game
#simple game