示例#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;
  }
示例#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);
  }
示例#3
0
文件: Block.java 项目: h00s/tetris
 public Block(Block block) {
   this(block.getX(), block.getY(), block.getColor());
 }