float sunX, sunY; //variables for sun float x, y; float dsunX; void setup() { size(600, 600); //screen size reset(); // funtion to reset to original scene. } void reset(){ sunX= width/2; // Reset the sun position. sunY=50; } void draw() { scene(); action(); } void scene(){ background(0, 175, 255);//background color fill(0, 200, 0); //green grass rectangle color rect(0, 300, 600, 300); //rectangle size //HOUSE fill( 255, 0, 0 ); // house color rect( 200, 250, 100, 50 ); //house size triangle( 200, 250, 300, 250, 250, 200 ); // Roof //SUN fill(255, 255, 0); //sun color ellipse( sunX, sunY, 30, 30 ); // Yellow sun } void action(){ sunX = sunX + 1; //add 1 to position of sun if (sunX > width) sunX= 0; } void keyPressed(){ if (key == 's'){ sunY= sunY + 50; } if (key == 'r'){ reset(); } }