TODO3 - Use two sequential if statements to determine if keys are pressed in order to move the paddle.
"public void paddleMovementCheck()"
   
  1. Find the TODO3.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 TODO3.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 paddleMovementCheck(){}" 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 LEFT key is pressed, then call some method to move the paddle left."
  7. Just below that, build a second if statement that asks: "if the RIGHT key is pressed, then call some method to move the paddle right."
  8. Inside your if statements, you'll need to call one or more API functions to determine if a key is being pressed; the API function you'll need are are described in the comments and also listed here for reference:

  9. Method Signature Description
    boolean isKeyboardButtonDown(KeysEnum targetKey) returns true if the key indicated by "targetKey" is being pressed, false otherwise
    void paddleMoveLeft(); call this function to make the paddle move left by one unit
    void paddleMoveRight(); call this function to make the paddle move right by one unit

    Type Values
    KeysEnum {LEFT, RIGHT, UP, DOWN, SPACE, ENTER, ESCAPE, SHIFT, ..., ONE, TWO, THREE, ..., A,B,C,...,a,b,c,...,z}

  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
    void paddleMoveLeft(int whichPaddle) call this function to move the paddle specified by whichPaddle to the left one unit
    void paddleMoveRight(int whichPaddle) call this function to move the paddle specified by whichPaddle to the right one unit