//aantal cirkels

int aantal = 6;

//arrays coordinaten

int [] X = new int[aantal];

int [] Y = new int[aantal];

//monster start coordinaten

int XB = 125;

int YB = 150;

//richting - speed - teller

int r=5;

int s=5;

int t=0;

//cirkel overlapping kleur

int kleur=207;

//monster ogen kleur dmv random

int eyeR=0;

int eyeG=0;

int eyeB=0;

void setup(){

size(1000,1000);

//loop positionering cirkels

for (int t=0; t < aantal; t++){

X[t] = int (random(50,950));

Y[t] = int (random(50,950));

}

}

void draw(){

//achtergrond

background(181,247,252);

fill(183,238,242);

rect(250,250,500,500);

fill(250,199,219);

rect(750,250,500,500);

fill(235,199,250);

rect(250,750,500,500);

fill(199,219,250);

rect(750,750,500,500);

fill(255,75);

ellipse(500,500,900,900);

noStroke();

//reset teller

t=0;

//loop overlapping - positionering - kleur - teller

while (t<aantal){

if(intersect(X[t],Y[t],XB,YB,50,90)){

kleur=189;

}

fill(kleur,244,250);

ellipse(X[t], Y[t], 100, 100);

t=t+1;

kleur=255;

}

//animatie monster

XB = XB + r;

YB = YB + s;

if ((XB > width-62) || (XB < + 62)){

r = r * -1;

t = t +1;

}

if ((YB > height-75) || (YB < +75)){

s = s * -1;

t = t +1;

}

//monster

rectMode(CENTER);

//onzichtbare cirkel rondom monster

fill(260);

ellipse(XB, YB, 180, 180);

//oren

fill(216, 138, 153);

ellipse(XB+30, YB-70, 45, 45);

ellipse(XB-30, YB-70, 45, 45);

//hoofd

fill(227, 142, 158);

ellipse(XB, YB, 125, 125);

//tong

fill(227,87,138);

noStroke();

ellipse(XB, YB+50, 50, 85);

//ogen

eyeR=int(random(255));

eyeG=int(random(255));

eyeB=int(random(255));

fill(eyeR,eyeG,eyeB);

ellipse(XB+25, YB-35, 25, 25);

ellipse(XB-25, YB-35, 25, 25);

//snuit

fill(252, 207, 215);

ellipse(XB, YB, 75, 75);

//neusgaten

fill(161, 159, 234);

noStroke();

ellipse(XB-20, YB, 20, 35);

ellipse(XB+20, YB, 20, 35);

}

boolean intersect(float x1, float y1, float x2, float y2, float r1, float r2){

// calculate distance

float distance = dist(x1,y1,x2,y2);

// compare distance to sum of radii

if (distance < r1 + r2)

{

return true;}

else

{

return false;}

}