/*Gravity test right and left to move click to jump don't fall!*/ int x=0, y=0, g=0, e=0; void setup(){ background(85,146,247); size(1200,600); smooth(); frameRate(30); } void draw(){ background(85,146,247); fill(255,247,5); //drawing clouds and sun and stuff ellipse(0,0,220,220); fill(193,189,189); ellipse(600,200,100,100); ellipse(640,193,80,100); ellipse(660,196,100,80); ellipse(500,200,100,100); ellipse(400,220,100,100); ellipse(440,213,80,100); ellipse(460,216,100,80); ellipse(540,201,100,100); ellipse(900,100,100,100); ellipse(940,93,80,100); ellipse(960,96,100,80); ellipse(990,96,60,65); stroke(255,247,5); strokeWeight(7); line(140,30,170,50); line(130,90,190,140); //sunbeams line(70,130,110,170); noStroke(); //platforms fill(157,84,5); rect(450,500,300,25); // light brown fill(63,206,25); rect(450,500,300,4); // green fill(82,43,2,51); rect(450,504,300,6); // dark brown fill(157,84,5); rect(50,500,300,25); // light brown fill(63,206,25); rect(50,500,300,4); // green fill(82,43,2,51); rect(50,504,300,6); fill(157,84,5); rect(850,500,300,25); // light brown fill(63,206,25); rect(850,500,300,4); // green fill(82,43,2,51); rect(850,504,300,6); fill(255,247,5); ellipse(600+x,481+g+y,35,35); //yellow circle fill(0); rect(590+(x+e),476+g+y,6,6); //left eye black rect(605+(x+e),476+g+y,6,6); //right eye blakc fill(255); rect(592+(x+e),478+g+y,2,2); //left eye white rect(607+(x+e),478+g+y,2,2); //right eye white if (keyPressed == false){e=0;} //eyes look center in no movement if(((500+g+y == 500) && (((600 + x <= 750) && (600+x >= 450)) || ((600+x <= 1150) && (600 +x >= 850)) || ((600+x <= 350) && (600 +x >= 50)) ))){g=0;y=0;} //no downward movement if on a platform else{g=g+5;} } void keyPressed(){ if (key == CODED) { if (keyCode == RIGHT) { //move right x = x + 15 ; e=5; //eyes move too } else if (keyCode == LEFT) { //left x = x-15; e=-5; } } } void mousePressed( ){ if ((((500+g+y == 500) && (((600 + x <= 750) && (600+x >= 450)) || ((600+x <= 1150) && (600 +x >= 850)) || ((600+x <= 350) && (600 +x >= 50)) )))){ y=y-55;} //jump only if on a platform and mouse is pressed }