package moreClasses;

import processing.core.PApplet;

public class Eye
{
    private static final int RADIUS = 25;
    
    private PApplet parent;
    private int centerX, centerY;
    private boolean open;
    
    public Eye(PApplet p, int cX, int cY)
    {
        parent = p;
        centerX = cX;
        centerY = cY;
        open = true;
    }
    
    public void drawSelf()
    {
        if(open)
            parent.fill(255);
        else
            parent.fill(0);
        
        parent.ellipse(centerX, centerY, RADIUS * 2, RADIUS * 2);
    }
    
    public void close()
    {
        open = false;
    }
    
    public boolean isInside(int x, int y)
    {
        return PApplet.dist(centerX, centerY, x, y) <= RADIUS;
    }
}
