Beispiel #1
0
  public boolean isColliding(int x, int y) {
    for (Block b : blocks)
      // if the block is a down block.
      if (b.getX() < x && x - b.getX() < b.getWidth() && b.getY() < y) return true;

    return false;
  }
Beispiel #2
0
  @Override
  public void paint(BufferedImage buf) {
    Graphics g = buf.getGraphics();
    g.setColor(Color.green);

    for (Block b : blocks)
      g.fillRoundRect(b.getX(), b.getY(), b.getWidth(), b.getHeight() + 10, 5, 5);
  }
Beispiel #3
0
 public Block(Block block) {
   this(block.getX(), block.getY(), block.getColor());
 }