Guest User

Untitled

a guest
Jun 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. import java.awt.*;
  2.  
  3. public class Brick {
  4.  
  5.  //add instance variables for the Brick class here
  6. Rectangle brickRect;
  7. int x;
  8. int y;
  9. boolean exists;
  10.  
  11.  public Brick(int x, int y, boolean exists) {
  12. brickRect = new Rectangle(x, y, BreakOutConstants.BRICK_WIDTH, BreakOutConstants.BRICK_HEIGHT);
  13. this.x = x;
  14. this.y = y;
  15. this.exists = exists;
  16.  }
  17.  
  18.  
  19. //-------------------------------------------------------------------
  20. //-------- DRAW THE BRICK OBJECT ------------------------------------
  21. //-------------------------------------------------------------------
  22.  public void drawBrick(Graphics g) {
  23.     Graphics2D g2d = (Graphics2D)g;
  24.     g2d.setStroke(new BasicStroke(2.0f));
  25.     g2d.draw(brickRect);    
  26.     g2d.setPaint(Color.blue);
  27.     g2d.fill(brickRect);
  28.  }
  29.  
  30.  public void makeDisappear() {
  31.    exists = false;
  32.  }
  33.  
  34.  public boolean getExists() {
  35.    return exists;
  36.  }
  37.  
  38.  public void changeBrickColor() {
  39.  }
  40.  
  41. }
Add Comment
Please, Sign In to add comment