Create an applet of bounces in JAVA

Create an applet that bounces a blue ball inside an applet using Thread.  The ball (diameter is 10) will start at position (0,0).  When the ball hits the edge of the applet, the ball should bounce off the edge at a randomly selected angle between 20 and 60 degrees  (Hint:  increase/decrease the x or y value by a random number of 2 to 6). Again, you must use the exact values that I stated in the questions to get credits.

More Hint:  When the ball hits the left edge (i.e. x <= 0), the x value should be increased.  When the ball hits the bottom edge, the y value should be decreased.

Bonus:  When the user click the mouse inside the applet, the ball will be suspended.  When the user click the mouse again, the ball will resume the motion but going in another direction.

 

 

   Related Questions in Programming Languages

©TutorsGlobe All rights reserved 2022-2023.