W1606 Score

From Coder Merlin
Revision as of 06:54, 20 March 2019 by Chukwuemeka-tinashe (talk | contribs) (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,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

DRAFT ICON

Exercises[edit]

  1. Add collision detection so that you are able to determine if the ball "hits" a paddle
    1. 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
  2. Track the score
    1. Begin with both the right and left sides at 0
    2. If a ball hits the left side of the canvas, then right's points increase by 1
    3. If a ball hits the right side of the canvas, then left's points increase by 1
    4. A side wins when their score reaches 9
  3. Display the score using large digits toward the top of the canvas
  4. When the game is over:
    1. Display a "Game Over" message over the entire canvas
    2. Hide the paddles
    3. Do not increment the score
    4. The ball should continue to bounce from edges as before