Objects, Arrays, and Conditionals

Solution to Recitation 6. Add these features:

  1. Replace ball0 and ball1  by a single array of objects.
  2. Add a property dy (1, -1, random(-5, 5), …) to make the balls drift horizontally.
  3. Each ball should bounce off the left and right edges of the canvas, just as it bounces off the bottom of the canvas. When a leftwards-moving ball hits the left edge of the screen, it should switch velocity and move right.