Pong From Scratch
You'll build Pong without a tutorial, with two paddles, one ball and a score, then play a full game against a real person at the same keyboard.
About
Pong is the smallest complete game there is, with input, movement, collision, scoring and a win state all on one screen. Build it without a tutorial, in any engine or language you like. If you get stuck, read the docs for the one thing you're stuck on, then close them again. The ball will get stuck inside a paddle at least once, and that's the collision lesson: you have to push it back out, not just flip its speed. Plan on one evening if you've coded before and two if you haven't.
At a glance
- Per requirement
- 15 XP
- Completion bonus
- 75 XP
- Requirements
- 5
- Takes
- One or two evenings
- Skill level
- Beginner (done it a few times)
- Cost
- Free
- Supplies
- Nothing special
- Where
- At home
- Other people
- With other people
Requirements
-
1
Draw two paddles and a ball, and move the paddles with the keyboard. Plain rectangles are fine. Put one paddle on W and S and the other on the Up and Down arrows, then clamp them so they can't leave the screen. Record both paddles moving and stopping at the edges. Video
-
2
Make the ball bounce off the walls and the paddles. Flip the vertical speed on the top and bottom walls and the horizontal speed on the paddles. Add a little angle based on where the ball hits the paddle, because without that the game is boring. Record ten clean bounces with the ball never sticking inside a paddle. Video
-
3
Score a point when the ball leaves a side, then reset the ball. Show the score on screen, and reset the ball to the center with a short pause so nobody gets ambushed by the next serve. First to seven wins. Take a screenshot of a 7 to 4 scoreboard. Photo
-
4
Add one sound effect and one win screen. A beep on each hit is plenty, and you can generate it for free with jsfxr in a browser. The win screen should name the winner and offer a restart key. Record a match ending and restarting so we can hear the beep and see the screen. Video
-
5
Play a full game against another person at the same keyboard. A human, elbow to elbow, not a bot. Take a photo of the two of you at the screen with the final score visible, and write one line about what felt wrong, whether the ball was too fast, the paddles too big or something else entirely. Photo