Modify a text file: $/201-gregory.pde
$/201-gregory.pde
// Gregory float sunX, sunY; //variables for sun float dsunX; float x, y; void setup() { size(600, 600); //screen size sunX= width/2; // Reset the sun position. sunY= 100; dsunX= 4; } void draw() { background(0, 175, 255);//background color fill(0, 200, 0); //green grass rectangle color rect(0, 300, 600, 300); //rectangle size house(); sun(); } //HOUSE; rectangular dwelling void house() { fill( 255, 0, 0 ); // house color rect( 200, 250, 100, 50 ); //house size triangle( 200, 250, 300, 250, 250, 200 ); // Roof } //// Draw and move the sun. void sun() { //SUN fill(255, 255, 0); //sun color ellipse( sunX, sunY, 30, 30 ); // Yellow sun // //-- sunX = sunX + 1; sunX = sunX + dsunX; //add 1 to position of sun if (sunX > width) { sunX= 0; } } //// EVENT HANDLERS: mouse, keys, etc. void keyPressed() { if (key == 's') { // Change sun speed dsunX=random(1, s5); } }