Pong, Properly
๐ฏ A ball bounces, a paddle follows the mouse, the score rises and the game ends when you miss.
๐ก The idea behind it
Bouncing is just reversing a direction โ and a game needs a clear beginning, middle and end.
๐งฑ Blocks you will need
foreverif on edge, bouncepoint in directiontouching?set score to 0stop all
๐จ Build it
- Paddle: forever โ set x to (mouse x). One block, and it feels perfect.
- Ball: point in direction (pick random โ45 to 45) โ forever โ move 10 steps โ if on edge, bounce.
- Add: if touching paddle โ point in direction (direction ร โ1) โ move 10 steps. That last move stops it sticking.
- Draw a red line along the bottom. If touching red โ say 'Game over' โ stop all.
- Add a score that rises on each paddle hit, and speed that rises with it.
๐ Make it harder
- Add bricks to break, using clones.
- Add a second player on the keyboard for the top paddle.
๐ Bugs you will hit
- The ball sticks to the paddle and vibrates: it is still touching when the direction flips. Add a 'move 10 steps' immediately after the bounce.
- The ball goes straight up and down and the game is boring: your starting direction has no sideways component โ use a random direction that is not near 0 or 180.
โฌ Need Scratch itself?
Free from MIT, in a browser or as an offline app that needs no connection at all.