Week 1 Day 3: Start a Pong Game

Learning Objectives:

  • Write event listener code for mouse and frame events
  • Write code to move movieclip instances
  • Use of Math.random() to add randomness to the ball's starting position and speed

How the Completed File Works:

  • The ball starts with a random angle and random y at the right edge of the stage.
  • Every time the ball returns to the right edge to start again, its angle and y are randomized.
  • The ball bounces off the top and bottom edges of the stage.
  • The score is displayed on stage.
  • Every time the paddle hits the ball, the score is incremented by 1.