Fox Studios logo Fox StudiosGame projects, devlogs and Scratch builds
Projects

How We Built a Two Player Pong Game in Scratch

Pong looks like the easiest game ever made: two paddles, one ball, a score. Then you build a Pong game in Scratch and the ball sticks inside a paddle, flies off at the same boring angle every time and speeds up until nobody can hit it.

Two kids at a laptop playing a simple black and white paddle and ball game on the screen, with a sticky note plan on the desk

Pong looks like the easiest game ever made: two paddles, one ball, a score. Then you build a Pong game in Scratch and the ball sticks inside a paddle, flies off at the same boring angle every time and speeds up until nobody can hit it. We ran into all three problems in one afternoon.

This is the devlog of how we built a two player Pong over two short sessions at our Saturday club, what broke and the small fixes that made it feel like a real arcade game. Everything here uses standard Scratch 3 blocks, no extensions.

Planning the Pong game in Scratch

We gave ourselves a hard scope before touching a block, the same rule we follow in why your first game should be tiny. The list fit on a sticky note:

  • Two paddles, one controlled with W and S, the other with the up and down arrows.
  • One ball that bounces off the top and bottom walls and off both paddles.
  • A score for each player, first to 7 wins.
  • The ball gets a little faster after each paddle hit.

No computer opponent, no power ups, no menus. Those could come later if the core felt good.

The Scratch stage is 480 by 360, with x running from -240 to 240 and y from -180 to 180. We put the left paddle at x = -210 and the right paddle at x = 210, which leaves about 30 pixels behind each one for the ball to pass through and trigger a point.

Building the paddles

Each paddle is a simple rectangle sprite, 12 pixels wide and 70 pixels tall. We drew it in the vector editor so it stays sharp.

The left paddle script is a forever loop with two checks. If key W pressed, change y by 8. If key S pressed, change y by -8. After both checks, we clamp the position so the paddle never leaves the stage: if y position is greater than 145, set y to 145, and if it is less than -145, set y to -145. The value 145 comes from the stage half height of 180 minus half the paddle height of 35.

The right paddle is a duplicate with the arrow keys swapped in. Duplicating saved time, but remember to rename both sprites clearly. We spent five minutes debugging the wrong paddle because both were called "Sprite2" and "Sprite3".

Making the ball bounce correctly

The ball starts each round at the center with a script like this:

  1. Go to x: 0, y: 0.
  2. Point in direction pick random 60 to 120, or 240 to 300 for the other side, so it serves toward a random player.
  3. Set a variable called speed to 5.
  4. Wait 1 second so both players can get ready.
  5. Forever: move speed steps, then run the collision checks.

For the top and bottom walls, we skipped the built-in "if on edge, bounce" block, because it also bounces off the left and right edges and we need the ball to pass those to score. Instead: if y position is greater than 172 or less than -172, point in direction (180 - direction). That flips the vertical motion and keeps the horizontal motion.

For the paddles: if touching LeftPaddle, point in direction (0 - direction). The same idea works for the right paddle. In Scratch, direction 90 is right and -90 is left, so negating the direction reverses horizontal travel while keeping the angle.

The sticky paddle bug

Our first test had the ball vibrating inside a paddle for a full second before escaping. The cause: after the bounce, the ball was still overlapping the paddle on the next frame, so it bounced again and again.

The fix is two lines. Right after the bounce, set x to -195 for the left paddle or 195 for the right, which pushes the ball clear of the paddle face. Then the next frame starts clean.

Adding angle and speed so rallies feel alive

With plain mirror bounces, every rally looked identical. The original arcade game varied the angle depending on where the ball struck the paddle, and that is what makes Pong feel skillful.

We replaced the left paddle bounce with: point in direction 90 - ((y position of ball - y position of LeftPaddle) * 1.2). A hit in the center sends the ball straight across. A hit near the top edge, about 35 pixels above center, sends it out at roughly 42 degrees upward. For the right paddle, the formula uses -90 instead of 90 and adds the offset instead of subtracting it.

Speed increases by 0.5 per hit, capped at 12. Without the cap, the ball eventually moved more than a paddle height per frame and passed straight through. Twelve steps per frame at 30 frames per second is fast but still fair.

Scoring and the win screen

Two global variables, ScoreLeft and ScoreRight, handle the score. In the ball's forever loop: if x position is greater than 235, change ScoreLeft by 1 and broadcast NewRound. If it is less than -235, change ScoreRight by 1 and broadcast NewRound. The NewRound script resets position, speed and serve direction.

When either score reaches 7, the ball broadcasts GameOver, and a text sprite shows "Left wins" or "Right wins" with a press space to restart prompt. We used large monospace numbers at the top of the stage for the scores, which instantly made it look like an arcade cabinet.

What we would tell you not to do

A lot of tutorials suggest adding a computer opponent right away so you can test alone. We think that is backwards for a first Pong. An AI paddle hides bad physics, because it never misses in a way that feels unfair. With two humans, every weird bounce gets called out loudly, and we found the sticky paddle bug in under a minute because one of us yelled about it.

Get the two player version feeling right first. Then add a computer paddle that follows the ball's y position at a capped speed of around 5 per frame so it can actually lose.

If you want a next step after Pong, remaking a classic arcade game as your second project walks through choosing one, and our scrolling platformer in Scratch devlog is a good jump in difficulty.

Frequently asked questions

How do you make a ball bounce off a paddle in Scratch?

Use an "if touching paddle" check inside the ball's forever loop, then point in direction (0 - direction) to reverse its horizontal travel. Immediately move the ball a few pixels away from the paddle so it does not bounce twice. Adding an offset based on where it hit the paddle makes the angle more interesting.

How long does it take to make Pong in Scratch?

A basic version takes about an hour for someone who knows the Scratch editor. Our polished version with angles, speed scaling, scoring and a win screen took two sessions of roughly 90 minutes each. Most of that time went into testing and fixing small physics bugs.

Is Pong a good first game to make in Scratch?

Yes, it is one of the best first projects because it teaches movement, collision, variables and broadcasts in a small space. It is also easy to finish, which matters more than ambition on a first game. Once it works, you can extend it with a computer player or power ups.

DF
Diego Fenn

Diego covers finished builds and the community around them, and runs the feedback threads that shape what the studio makes next.

More posts by Diego

More in Projects

01doorganico 084goad 3hot8 4465456 after5internprogram ahandfulofblessings ahmadpc ahomcybersecurity allodialresources annodex antiquesandperiodcollectibles aotc asianworldkashmir beedlectrics bloggertemplatefree bluefeatheragency bodyweightsolution campaign08blog carfixadvisor catstreetcollective cbstvsports cnfanspurchasing committeeof500yearsofdignityandresistance covertopsdjs cs-kaiyuangame cuestacomunicaciontotal cxoutlet dancebetgame deskgearhub destinyvillastay detectmagazine di33 diamondsteelbuildings donmo dyanadropship emarsysfinance emimattl escapechan eskitarih evautoplay everythingweddings-orlando farmzone feedviewerapp gamevui123 gleasongrade greetingsday hacklabasu haskell iw-kaiyun jagoanproperti jilidskripsi joltbusinessfinance juegodepokergratis juegospucca kaeru-festival latestmehndidesigns lestanzediottaviano litemagazines localcommunityhero lustrsazan mariashebets menswheels newwebstechs1 nikkit ootheday oxigenvpn plurfitness prefetial probudgetcarpetcleaning psychicmrsmartin pyaten qvantor rejoignezlogis rexzbot riselayouts ruchin rwxqsgd5 sakaltime shibiaowang shop-bot skrtips spotlesshaven strcoding tetapatrium topselller uneplanteartificielle vipertechcr webtech1223411 wo-kygaming yamaha-mekar yeknava yoybuysheets zenunwa yamaha-mekar jilidskripsi ankertoto ankertoto ankertoto