////James Doyle Project 1 //global date float horizon; float gravity=1*9.81/frameRate; int guyX=100,guyY=100,guyDX=10,guyDY=5; int birdX=100; int birdY=100; // Initial position of bird int birdDX=3; int defX=100, defY=600, defDX=20, defDY=10; //def bounces int sunX=10, sunY=100; //position of sun int speed; int size=20; float puckX,puckY; //starting position float puckXSpeed=8; //puck speed float puckYSpeed=8; //puck speed int puckDX=1; int puckDY=1; void setup() { size(1000,800); smooth(); frameRate(10); speed=(int) frameRate; noCursor(); puckX=width/2; //puck starting position puckY=height/2; //puck starting position } void draw() { ///draw everything scene(); guy(); stick(); def(); defstick(); bird(); puck(); } void scene() { ///background sky grass background (0,0,250); fill(255,255,0); ellipse(sunX, sunY, 50, 50); //Sun fill(255,255,255); sunX = (sunX+1) % width; //sun path float sun= (float) sunX / width; sunY =(int)(150-100*sin(PI*sun)); horizon=height/3; rectMode(CORNERS); rect(0,height/3, width, height); fill(0,0,0); text("James Doyle, CST 112, Project 1",10,790); //clouds strokeWeight(0); fill(255,255,255,200); rect(0,0,width,30); fill(255,255,255,150); rect(0,0,width,20); fill(255,255,255,100); rect(0,0,width,10); strokeWeight(2); } void guy() { ///guy follows mouse fill(0,0,255); //shirt rectMode(CENTER); rect(mouseX,mouseY, 50,70); fill(255,255,255); //stripe rect(mouseX,mouseY+18,50,7); fill(255,127,0); //crest ellipseMode(CENTER); ellipse(mouseX,mouseY-9,30,30); fill(255,127,0); //pants rect(mouseX,mouseY+40,50,25); fill(225,225,225); //left shin rect(mouseX-12,mouseY+70,20,40); fill(225,225,255); //right shin rect(mouseX+12,mouseY+70,20,40); fill(255,255,140); //head //////details ellipse(mouseX,mouseY-50,30,30); fill(0,0,0); //helmet rect(mouseX,mouseY-65,35,10); fill(0,0,0);//left ear flap rect(mouseX-15,mouseY-55,5,10); fill(0,0,0);//right ear flap rect(mouseX+15,mouseY-55,5,10); fill(0,0,0); //left eye ellipse(mouseX-4,mouseY-52,3,3); fill(0,0,0); //right eye ellipse(mouseX+4,mouseY-52,3,3); fill(0,0,0); //left skate rect(mouseX-16,mouseY+85,28,10); fill(0,0,0); //right skate rect(mouseX+16,mouseY+85,28,10); strokeWeight(1); //left skate blade fill(210,210,210); rect(mouseX-16,mouseY+92,28,3); fill(210,210,210); //right skate blade rect(mouseX+16,mouseY+92,28,3); strokeWeight(2); fill(0,0,255); //left arm rect(mouseX-23,mouseY,10,55); fill(0,0,255); //right arm rect(mouseX+23,mouseY,10,55); } void stick() { ///attempt at a hockey stick strokeWeight(5); line(mouseX-23,mouseY+18,mouseX+50,mouseY+80);//position of stick strokeWeight(10); line(mouseX+50,mouseY+80,mouseX+70,mouseY+80);//position of blade strokeWeight(2); } void def() { //def moves and bounces off walls defDX= defX>50 && defXhorizon && defY150) { birdY=birdY-5; } else if(birdY<-200) { birdY=birdY-10; } } void puck() { puckX=puckX+(puckXSpeed*puckDX); //updated position of puck puckY=puckY+(puckYSpeed*puckDY); //establishing puck boundaries if(puckX>width-size || puckX<0) { puckDX *=-1; } if(puckY>height-size || puckY