TODO5 - Use a single if statement with && to combine all nested if statements into one.
"public void mouseSpawnBallCheck()"
   
  1. Complete the lab section first for practice with Space Smasher before moving on to the assignment.
  2. Remember to experiment with your game by enabling and disabling the solution to observe the desired behaviour (see the Stepwise Approach below).
  3. Find the TODO5.java starter file; run the empty solution file and explore the behaviour that you will replicate with your code.
  4. Next, read all of the comments at the top of the file in the file header.
  5. Determine the single function you need to declare inside the empty class. It's described in the comments and also at the top of this webpage.
  6. Declare the function "public void mouseSpawnBallCheck(){}" and leave it empty and rerun the game - do you notice any missing behaviour?
  7. Inside your method, you must build one if statement that asks: "if the mouse is onscreen AND is the left-button being clicked AND is the ball currently invisible? If so, spawn a ball."
  8. Inside your if statement, you'll need to call one or more API functions to spawn balls, which are described in the comments and also listed here for reference:

  9. Method Signature Description
    boolean isMouseOnScreen() returns true if a mouse is connected to your computer
    boolean isMouseButtonDown(MouseClicksEnum targetButton) returns true if the button indicated by "targetButton" is being clicked, false otherwise
    boolean ballGetVisibility() returns true if the ball is currently visible on the screen
    void ballSpawnNearPaddle() call this function to spawn a new ball near the paddle

    Type Values
    MouseClicksEnum {LEFT, RIGHT, CENTER}

  10. Once you've experimented with the methods above, consider playing with the extended set of methods below for even more complex and fun game behaviors

  11. Extended Method Signature Description
    boolean ballGetVisibility(int whichBall) returns true if the ball specified by whichBall is currently visible on the screen
    void ballSpawnNearPaddle(int whichBall, int whichPaddle) call this function to spawn a ball specified by whichBall near the paddle specified by whichPaddle