Modify a text file: $/x207.pde
$/x207.pde
// text// Draw a "surprised egg" int x, y, speedx, speedy; //The x- and y- coordinates of the happy face //set the size of the output window void setup() { size(400,500); // the direction and speed added to x-coordinate, y coordinate. x= width/2; y = height/2; speedx = 3; speedy = 3; } void draw() { drawBackground(); drawEgg(); moveEgg(); bounceEgg(); } void drawBackground() { fill(10); background(255,194,255); } void drawEgg() { //Draw an oval egg shaped body. stroke(10); fill(#FFF415); ellipse(x,y, 100,150); //Draw the eyes fill(255); stroke(10); ellipse(x-15, y-30, 25, 30); ellipse(x+15, y-30, 25, 30); fill(10); ellipse(x-15, y-30, 10, 20); ellipse(x+15, y-30, 10, 20); mouth(); } void mouth() { //Draw the mouth strokeWeight(4); stroke(10); fill(255); ellipse(x+2 ,y+30, 30,20); } void moveEgg() { x = x+ speedx; y= y+ speedy; } void bounceEgg() { if( x<70 || x> width -70) { speedx= -speedx; } if (y<100 || y>height -100) { speedy= -speedy; } }