
/**
 * Face is a class that builds upon the shape classes, Circle
 * and Triangle, to draw a simple face.
 *
 * @author  Dave Reed
 * @version 1/28/10
 */
public class Face {
    private Circle head;
    private Circle leftEye;
    private Circle rightEye;
    private Triangle mouth;

    /**
     * Constructor for objects of class Face
     */
    public Face() {
        this.head = new Circle();
        this.head.changeSize(100);
        this.head.changeColor("yellow");
        
        this.leftEye = new Circle();
        this.leftEye.changeSize(10);
        this.leftEye.changeLoc(50,90);
        
        this.rightEye = new Circle();
        this.rightEye.changeSize(10);
        this.rightEye.changeLoc(80,90);

        this.mouth = new Triangle();
        this.mouth.changeSize(-10, 50);
        this.mouth.changeLoc(70, 130);
        this.mouth.changeColor("red");
    }
    
        /**
     * Slowly move the face horizontally by 'distance' pixels.
     */
    public void moveHorizontal(int distance) {
        int step = distance/Math.abs(distance);
        for (int i = 0; i < Math.abs(distance); i++) {
            this.head.moveHorizontal(step);
            this.leftEye.moveHorizontal(step);
            this.rightEye.moveHorizontal(step);
            this.mouth.moveHorizontal(step);
        }
    }

    /**
     * Slowly move the face vertically by 'distance' pixels.
     */
    public void moveVertical(int distance) {
        int step = distance/Math.abs(distance);
        for (int i = 0; i < Math.abs(distance); i++) {
            this.head.moveVertical(step);
            this.leftEye.moveVertical(step);
            this.rightEye.moveVertical(step);
            this.mouth.moveVertical(step);
        }
    }
}
