TODO2 - Use a single if statement to determine if the mouse is present, and then set the paddle to the mouse's "x" coordinate.
"public void mousePaddleMovementCheck()"
   
  1. Find the TODO2.java starter file; this empty class also serves as a solution you can experiment and play with.
  2. Next, read all of the comments at the top of the file in the file header.
  3. Set your runner in Main.java to use TODO2.java and comment out any other setRunner calls. (see the stepwise approach for more details)
  4. 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.
  5. Declare the function "public void mousePaddleMovementCheck(){}" and leave it empty and rerun the game - do you notice anything different?
  6. Inside your method, you must build one if statement that asks: "if the mouse is onscreen, then call some method to determine it's x value and call another method to set the paddle to that x location."
  7. After you've determined that the mouse is onscreen, then inside the body of the if (i.e., inside {}) you should call other methods to get the mouse's x and set the paddle's x position, in that order.
  8. Inside your if statements, you'll need to call one or more API functions to determine if a mouse is onscreen; the API function you'll need are are described in the comments and also listed here for reference:

  9. Method Signature Description
    boolean isMouseOnScreen() returns true if a mouse is connected and usable in our game
    float getMouseXCoordinate() returns the x value in pixels associated with the position of the mouse cursor on screen.
    float getMouseYCoordinate() returns the y value in pixels associated with the position of the mouse cursor on screen.
    void paddleSetCenterX(float x) call this function to make the paddle move to the position indicated by the value "x" handed to it as input