//Nicholas Short //Shoot-the-target //player is crrently in military training //player will move and fire gun with the intent of hitting the target //mouse click will shoot individual bullets //keypressed will express winning state //mouse dragged will rapid fire weapon void setup(){ size(400,400); rectMode(CENTER); ellipseMode(CENTER); noCursor(); } void draw(){ background(0); //moving target on X axis rect(sin(frameCount/14)*150+200,190,50,70,20); rect(sin(frameCount/14)*150+200,150,30,30,10); //bullet holes on moving target fill(0); stroke(255); strokeWeight(2); ellipse(sin(frameCount/14)*150+190,183,10,12); ellipse(sin(frameCount/14)*150+217,200,10,12); ellipse(sin(frameCount/14)*150+206,145,10,12); //Walls for cover fill(100); rect(80,210,80,120); //extra layer for color change fill(0,200,100,mouseX/400.0*255); rect(80,210,80,120); //bullet holes for wall fill(0); stroke(255); strokeWeight(4); ellipse(70,186,10,12); ellipse(90,195,10,12); ellipse(80,163,10,12); ellipse(100,176,10,12); ellipse(72,250,10,12); strokeWeight(1); fill(100); rect(300,230,60,150); //layer for color change fill(100,0,200,pmouseX/400.0*255); rect(300,230,60,150); fill(0); stroke(255); strokeWeight(4); ellipse(310,178,10,12); ellipse(280,195,10,12); ellipse(317,250,10,12); ellipse(290,234,10,12); //ellipse sight noFill(); stroke(255); strokeWeight(6); ellipse(mouseX,250+mouseY,130,190); noFill(); stroke(255); strokeWeight(3); ellipse(mouseX,195+mouseY,30,50); //gun body fill(100); stroke(255); //barrel triangle(mouseX-55,270+mouseY,mouseX,190+mouseY,mouseX+55,270+mouseY); //gunbody to cover barrel rect(mouseX,330+mouseY,180,120,40); fill(150); rect(mouseX,380+mouseY,210,40); rect(mouseX-105,305+mouseY,40,60,40); rect(mouseX+105,305+mouseY,40,60,40); //small sight rect(mouseX,200+mouseY,10,15); strokeWeight(2); stroke(255); line(mouseX,185+mouseY,mouseX,195+mouseY); //lines to fill barrel and create perception of depth stroke(255); line(mouseX-40,260+mouseY,mouseX+40,260+mouseY); line(mouseX-30,245+mouseY,mouseX+30,245+mouseY); line(mouseX-20,230+mouseY,mouseX+20,230+mouseY); line(mouseX-10,215+mouseY,mouseX+10,215+mouseY); } void mousePressed(){ background(130,70,30); //most likely will motivate player to continue shooting println("haha you missed"); //bullets do not necessarily follow mouse. trying to imitate bullet physics fill(0); stroke(255); strokeWeight(3); ellipse(mouseX,120+mouseY,10,12); } void keyPressed(){ //shapes to create L that will flash on screen fill(255); stroke(0,0,255); strokeWeight(5); //base ellipse(200,200,200,200); noStroke(); fill(255,0,0); //shapes that form L rect(190,190,30,150); rect(215,250,80,30); println("Take the L"); } void mouseDragged(){ //rapid fire fill(200,100,0); stroke(255,50,0); strokeWeight(4); ellipse(mouseX,195+mouseY,40,40); println("Hold your fire soldier"); }