//p1 //Alex Dahlgren Project 1 float AlexX, AlexY; //hero float johnX, johnY; //monster float horizon; float sunPX = 3, sunPY; float sunX, sunY; //sun placement void setup() { size( 640, 480); frameRate( 30 ); johnX = pmouseX; johnY = pmouseY; AlexX = width*3/5; AlexY = height*3/5; sunX = width*4/5; sunY = height/5; horizon = height/3; } void draw() { //new frame Alex(); scene(); john(); } void scene(){ background( 50, 200, 250); fill(200,0,00); textSize(10); text("John the monster chases the hero Alex", 20,20); sun(); house(); //grass fill(0,250,0); rectMode(CORNER); rect(0,horizon, width, height*3/4); fill( 255, 240, 3); ellipseMode(CENTER); noStroke(); ellipse( sunX, sunY, 30,30); } void sun() { sunX = sunX + sunPX; sunX = sunX % width; sunY = horizon - 100*sin(PI * sunX/width); //sun rise +fall horizon = height/3; } void house() { float houseX, houseY; houseX=width*1/2; houseY=horizon-20; fill(0,0,120); noStroke(); rectMode(CENTER); rect(houseX, houseY, 40,50); fill(255,0,20); triangle( houseX-30, houseY-20, houseX+30, houseY-20, houseX, houseY-100); //aestetics fill(255,0,0); rect(houseX+10,houseY-10,10,10); rect(houseX-10,houseY-10,10,10); rect(houseX,houseY+15,5,10); } void Alex() { } void john () { }