//// Project 2 Carl the robot chases allen the alien to steal gold //// CST 112 Talha Riaz 2015 Mar 11 String title= "carl the robot chases allen to steal his gold"; String author= "Talha Riaz: CST 112 3/11/15"; int score=0; float sunX=110, sunY=110; float horizon; float houseX, houseY, hW=100, hH=80; float goldX, goldY; float carlX, carlY, carlW=45, carlZ=60; // robot float allenX, allenY, allenW=60, allenH=80; // hero; float treeX, treeY; void setup() { size( 820,700 ); horizon= height/3; sunY= horizon/3; houseX= width-2*hW; houseY= horizon-hH; score=0; reset(); } void reset() { // Carl and allen start on //opposite ends if (random(1)>0.8 ) { allenX= width-10; carlX=10; } else { allenX= width-10; carlX=10; } allenY= random( horizon, height-40 ); carlY= random( horizon, height-40 ); goldX= random( width/2, width*3/2 ); goldY= random( horizon+150,height-60); mouseY= height; } void draw() { scene(); //-- gold(); allen(); carl(); //-- collisons(); fill(0); text( title, width/2, 25 ); text( author, 25, height-25 ); } void scene() { background( 155,155,255 ); // Dont know the color but its a blue sky fill( 200,255,0 ); //sun ellipseMode( CORNER ); noStroke(); ellipse( sunX, sunY, 60,60 ); fill( 0,255,0 ); // Grass noStroke(); rectMode( CORNER ); rect(0, horizon, width, height ); if ( sunX > width ) { sunX= 1; sunY= random( 20, horizon-20 ); } sunX= sunX+4; for( float x=20; x