TODO6 - Use a single if with && to determine if the space key is pressed AND the ball is invisible, all in order to spawn a ball.
"public void spawnBallCheck()"
   
  1. Find the TODO6.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 TODO6.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 spawnBallCheck(){}" and leave it empty and rerun the game - do you notice anything different?
  6. Inside your method, build a single if statement that asks: "if the SPACE key is pressed AND the ball is invisible, then call some method to spawn the ball near the paddle."
  7. Inside your if statement, you'll need to call one or more API functions to determine if the space key is being pressed; the API function you'll need are are described in the comments and also listed here for reference:

  8. Method Signature Description
    boolean isKeyboardButtonDown(KeysEnum targetKey) returns true if the key indicated by "targetKey" is being pressed, false otherwise
    boolean ballGetVisibility() returns true if the ball is visible, false otherwise
    void ballSpawnNearPaddle(); call this function to make a ball visibly appear next to the paddle

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