IBCS1 - 1718 - June

From WLCS
Jump to: navigation, search

Tuesday - Thursday (6/5/18 - 6/7/18)

Agenda:

Friday (6/1/18)

Agenda:

  • TURN IN FINAL EXAM EXEMPTION SLIPS!
  • Demo Brick assignment (row of flashing bricks using the test main code below)
  • Brick collision assignment
    1. Now that you have Bricks that can display, implement the following methods in the Brick class:
      • boolean hitTop(Ball b) - returns true if the Ball b's bottom edge hits the top side of a visible Brick (i.e. check for visibility too); return false otherwise (HINT: You basically have this method already done...)
      • boolean hitBottom(Ball b) - returns true if the Ball b's top edge hits the bottom side of a visible Brick (i.e. check for visibility too)
      • boolean hitLeft(Ball b) - returns true if the Ball b's right edge his the left side of a visible Brick (i.e. check for visibility too)
      • boolean hitRight(Ball b) - returns true if the Ball b's left edge his the right side of a visible Brick (i.e. check for visibility too)
    2. To demonstrate this assignment, modify the Brick test code that was given to you, so that the row of Bricks no longer blink. Instead, add if-statements to check if the ball hits the top OR bottom of a visible Brick, then turn the Brick invisible and reverse the ball's dy. If the ball hits the left or right of a visible Brick, then turn the Brick invisible and reverse the ball's dx.