TODO1 - Use a single if statement detect block and ball collisions and handle them.
"public void ballAndBlockCollisionCheck()"
   
  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 TODO1.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 ballAndBlockCollisionCheck(){}" 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 ball collided with a block, then call the function that handles block and ball collisions."
  8. Inside your if statement, you'll need to call one or more API functions to handle block and ball collisions, which are described in the comments and also listed here for reference:

  9. Method Signature Description
    boolean ballCollidedWithBlock() returns true if the ball image is overlapping with any block image on the screen
    void handleBlockBallCollision() call this function to when you know there has been a collision between the ball and any block in order to process the collision and destroy the block

  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 ballCollidedWithBlock(int whichBall) returns true if the ball image specified by "whichBall" is overlapping with any block image on the screen