xxxxxxxxxx
int dirY = 1;
int y = 450;
int dirX = 1;
int x = 150;
void setup () {
size (1500, 500);
background (142, 155, 198);
}
void draw () {
size (1500, 500);
background (142, 155, 198);
fill (255);
ellipse (x, y, 50, 50);
ellipse (x - 10, y - 15, 10, 10);
if (mouseY < height/2 || mouseX >= width - 15 || mouseX <= 15) { // Agitated
frameRate(250);
size (1500, 500);
background (142, 155, 198);
fill (255);
ellipse (x, y, 50, 50);//outline
ellipse (x - 15, y - 10, 15, 1); // left eye
ellipse (x + 15, y - 10, 15, 1); // right eye
triangle (x, y - 5, x - 10, y + 5, x + 10, y + 5); //mouth
y = y - dirY; // bounce
x = constrain (mouseX + dirX, 25, width - 25); // you shall not pass
if (y > height/2 + 200 || y < 400 ) // bounce up limits
dirY = dirY * -1;
frameRate (300); // Shaking intensifies
if (x > width - 100 || x < 0 );
dirX = dirX * -1;
}
else if (mouseY > height/2) { // Content
frameRate(150);
size (1500, 500);
background (142, 155, 198);
fill (255);
ellipse (x, y, 50, 50); //outline
ellipse (x - 15, y, 15, 25); // left eye
ellipse (x + 15, y, 15, 25); // right eye
y = y - dirY;
x = constrain (mouseX, 25, width - 25);// you shall not pass
if ( y > height/2 + 200 || y < 400) // bounce up limits
dirY = dirY * -1;
}
print( "the value of y is " + y);
print( "the value of x is " + x);
}