/* CST 112 - Project 2 - Alien chases Isaac, who doesn't even know it because all he cares about is gold Juan Vaccalluzzo, 2015 Mar 13 */ String title= "Alien chases greedy Isaac"; String author= "Juan Vaccalluzzo"; int score=0; float sunX=100, sunY=100; float horizon; float houseX, houseY, houseW=120, houseH=80; float goldX, goldY; float isaacX, isaacY, isaacW=65, isaacH=100; float alienX, alienY, alienW=100, alienH=50; void setup() { // setup size( 850,625 ); horizon= height/4; sunY= horizon/2; houseX= width - 2*houseW; houseY= horizon-houseH; score=0; reset(); } void reset() { // Isaac and Alien start if (random(1) > 0.5) { // at opposite ends isaacX= width-50; alienX= 30; } else { alienX= width-50; isaacX= 50; } isaacY= random( horizon,height-75 ); alienY= random( horizon,height-75 ); goldX= random( width/4, width*3/4); goldY= random(horizon+200,height-50); mouseY=height; } void draw() { // next frame scene(); gold(); isaac(); alien(); collisions(); fill(0); text( title, width/3, 30 ); text( author, 30, height-30 ); } void scene() { // Scene: sky, sun, grass. background( 220, 195, 255 ); // Light blue sky. fill( 250, 255, 3 ); // Sun ellipseMode( CORNER ); noStroke(); ellipse( sunX,sunY, 75,75 ); fill( 22, 222, 57 ); noStroke(); // Grass rectMode(CORNER); rect( 0, horizon, width, height ); if ( sunX > width ) { sunX= 0; sunY= random( 20, horizon-30); } sunX= sunX+5; text( sunX, sunX, sunY+50 ); for ( float x=30; x