// Project #1 // // Stacy Aparicio, CST 112, March 16 2015 // float kayX , kayY; float booX , booY; float horizon, sunX, sunY; void setup() { // Setup: window size // size( 640 , 480 ); horizon= ( height /4 ); } void draw() { scene(); sun(); house(); boo(); kay(); } void scene() { // light blue sky // background( 190 , 250 , 255 ); // light green grass // fill( 200 , 255 , 140 ); rectMode(CORNER); rect( 0 , horizon + 0 , width , height *4 ); // Title, name, etc // fill( 0 ); textSize( 20 ); text( "boo follows kay", width/3, 20 ); textSize( 12 ); text( "Stacy Aparicio, CST 112, 2015 Mar 11", 20, height -20 ); } void sun() { // Sun moves slowly to the right // sunX= sunX + 1 ; sunX= sunX % width ; sunY= horizon - 100 * sin( PI * sunX/width ); // Rise & set // fill( 255 , 200 , 0 ); ellipse( sunX , sunY , 50 , 50 ); fill( 0 ); } void house() { // House // float houseX, houseY ; houseX = width *2/3 ; houseY = horizon -60; fill( 0 , 0 , 255 ); noStroke(); rectMode( CORNER ); rect( houseX , houseY , 100 , 60 ); triangle( houseX , houseY , houseX +50 , houseY , houseX +50 , houseY -15 ); stroke( 0 ); // Windows & door // fill( 0 ); rect( houseX +5 , horizon -50 , 20 , 30 ); rect( houseX +75 , horizon -50 , 20 , 30 ); rect( houseX +40 , horizon -50 , 20 , 50 ); } void kay() { // kay follow mouse // color purple // rectMode(CENTER); // Creature head // fill( 200 , 0 , 200 ); ellipse( mouseX , mouseY -20 -30 , 40 , 30 ); // Creature body // fill( 255 , 0 , 255 ); rect( mouseX , mouseY , 30 , 60 ); } void boo() { // boo follow kay // color cream // booX = booX + 1; rectMode(CORNER); // Monster head // fill( 250 , 223 , 145 ); ellipse( booX +15 , booY , 50 , 20 ); // Monster body // fill( 250 , 223 , 143 ); rect( booX , booY +20 , 30 , 60 ); }