How does it work?
- When the user click on the canvas, new
Ball object is created at user clicked position.
Ball object is random. They represent x direction velocity and y direction velocity of
- The holes are created at corners of canvas. They are also
Ball objects with black color. Their
are assigned to zero so that they are stationary.
- The bounce with borders are done by checking the
Ball with respect to canvas
yVel is negated according the collided border.
- Whether the ball enter hole is determined by Pythagoras theorem using
yPos of ball and hole.
- Everything is updated inside
draw function using