W1606 Score
From Coder Merlin
Revision as of 06:59, 20 June 2019 by Chukwuemeka-tinashe (talk | contribs)
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