//Brandon Brideau. Guy and dog ////Gloabal Data String author="Brandon Brideau"; String title="The amazing dog who can follow a HUMAN!"; float dudeX,dudeY,dudeDX,dudeDY; float dogX,dogY,dogDX,dogDY; float sunX,sunY,sunDX,sunDY; float birdX,birdY,birdDX,birdDY; int Yrand; float bombX,bombY,bombDX,bombDY; boolean bomb = false; ///Setup\\\ void setup(){ size(800,500); frameRate(50); //title and author fill(0); ////initialize sunX=20; sunY=180; dudeX=400; dudeY=400; dudeDX=3; dudeDY=3; birdX=60; birdY=80; birdDX=6; birdDY=6; Yrand=0; bombX=-100; bombY=-100; bombDX=1; bombDY=1; dogX=dudeX-50; dogY=dudeY; dogDX=5; dogDY=5; } ////Scene\\\\ void draw(){ scene(); drawdude(); sun(); bird(); dog(); bomb(); fill(0); text("bombX" +bombX + ", bombY" + bombY, 10,10); text(title,10,height-20); text(author,10,height-10); } ////background\\\\ void scene(){ rectMode(CORNER); noStroke(); //sky fill(133,182,245); rect(0,0,800,200); //grass fill(56,206,125); rect(0,200,800,500); } ////sun\\\\ void sun(){ fill(240,233,36); ellipse(sunX,sunY,30,30); } ////dude\\\\ void drawdude(){ //move movedude(); //head fill(237,208,160); ellipse(dudeX,dudeY,50,50); //body fill(45,45,45); rect(dudeX-25,dudeY+25,50,60); } //moving dude void movedude(){ if (dudeX>=780||dudeX<=20) {dudeDX=-dudeDX;} if (dudeY>=420||dudeY<=220) {dudeDY=-dudeDY;} dudeX+=dudeDX; dudeY+=dudeDY; } //bird void bird(){ //move movebird(); //draw fill(111,111,234); triangle(birdX,birdY,birdX-50,birdY+20,birdX-50,birdY-20); fill(133,182,245); triangle(birdX-40,birdY,birdX-50,birdY+20,birdX-50,birdY-20); text( "birdX= "+birdX, 10,10); text( "birdY= "+birdY, 10,20); } //moving bird void movebird(){ int Yrand = int (random(1,100)); if(birdX>=850){ birdX=60; birdY=80;} if(Yrand>=95){ birdY-=birdDY;} if(Yrand<=5){ birdY+=birdDY;} if(birdY<=10){ birdY+=20;} if(birdY>=180){ birdY-=20;} birdX+=birdDX; } //dog void dog(){ movedog(); fill(140,70,50); rectMode(CENTER); if (dogX>dudeX){ rect(dogX,dogY,35,20); rect(dogX+37,dogY+25,60,35);} if (dogX40) {dogX+=dogDX;} if(dogX>800||dogX<0) {dogDX*=-1;} if(dogY-dudeY<50) {dogY+=dogDY;} if(dogY-dudeY>50) {dogY-=dogDY;} } //bomb void bomb(){ fill(100,100,100); ellipse(bombX,bombY,25,50); triangle(bombX-1,bombY-30,bombX-1,bombY-10,bombX-15,bombY-30); triangle(bombX+1,bombY-30,bombX+1,bombY-10,bombX+15,bombY-30); dropbomb(); } //keypress for bomb void keyPressed(){ if(key=='b') {bomb=true;} } //bomb drop void dropbomb(){ if(bomb==true&&bombY==-100){ bombX=birdX;bombY=birdY;} if (bomb==true&&bombY=height) {bombY=-100;bombX=-100;bomb=false;} }