Difference between revisions of "W1606 Score"
From Coder Merlin
(Created page with "DRAFT ICON == Exercises == # Add '''collision detection''' so that you are able to determine if the ball "hits" a paddle ## If the ball hits a paddle,...") |
|||
Line 1: | Line 1: | ||
[[File:DRAFT ICON.png|DRAFT ICON]] | [[File:DRAFT ICON.png|DRAFT ICON]] | ||
== Prerequisites == | |||
[[W1605 Only One]] | |||
== Exercises == | == Exercises == |
Revision as of 06:59, 20 June 2019
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
Prerequisites[edit]
Exercises[edit]
- Add collision detection so that you are able to determine if the ball "hits" a paddle
- If the ball hits a paddle, it should bounce off in exactly the same way that it would bounce from the left or right edge of the canvas
- Track the score
- Begin with both the right and left sides at 0
- If a ball hits the left side of the canvas, then right's points increase by 1
- If a ball hits the right side of the canvas, then left's points increase by 1
- A side wins when their score reaches 9
- Display the score using large digits toward the top of the canvas
- When the game is over:
- Display a "Game Over" message over the entire canvas
- Hide the paddles
- Do not increment the score
- The ball should continue to bounce from edges as before