private void colorBrick(int row, GRect brick) { if (row < 2) { brick.setColor(Color.RED); } else if (row < 4) { brick.setColor(Color.ORANGE); } else if (row < 6) { brick.setColor(Color.YELLOW); } else if (row < 8) { brick.setColor(Color.GREEN); } else if (row < 10) { brick.setColor(Color.CYAN); } }
private void buildMouth() { double startingWidth = getWidth() / 2 - mouth_width / 2; double startingHeight = getHeight() / 2 + head_height / 4 - mouth_height / 2; GRect mouth = new GRect(startingWidth, startingHeight, mouth_width, mouth_height); add(mouth); mouth.setColor(Color.WHITE); mouth.setFilled(true); mouth.setFillColor(Color.WHITE); }
/** Places a rectangle at x,y with width, height and specified color */ public void place(int x, int y, int width, int height, Color shapeColor) { GRect shape = new GRect(x, y, width, height); shape.setFilled(true); shape.setColor(shapeColor); add(shape); }