Making an Atari Breakout Game in Scratch: Part 2
Two weeks ago, you learned how to make the prototype of the famous Atari Breakout game on Scratch. This week, we'll make this protype a little closer to the real thing.
Try the actual game here: Atari Breakout
Code for the Ball:
Bouncing off the Blocks
-
This block simply turns the direction of the ball to the opposite direction (in our case, downwards) and sends it off at a certain angle based on the angle
in which you hit the block with.
Hiding the Blocks
-
When the ball hits / touches a block, the block will disappear with the "hide" command! One detail to note is the "wait" block: waiting 0.01 seconds will make sure
that the ball bounces back before the block disappears or hides.
Score
-
Whenever your ball hits a block, you score a point! There is no limit to how many points you can score.402px
Game Over
-
If your ball hits the red line / bottom of the screen, you lose!
Code for the Paddle:
Moving
-
This block tracks you mouse's position, and moves the paddle there. This way, you can control the motion of the paddle by dragging
your mouse across the game screen. As you can see in the image, the "set x to mouse x block" is repeated forever (until the game finishes, of course),
so you will be able to constantly move your mouse and the paddle will follow with little to no delay.
Youtube Tutorial
Final Product