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; }
@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); }
public Block(Block block) { this(block.getX(), block.getY(), block.getColor()); }