diff --git a/raindropGameCode/Bucket.pde b/raindropGameCode/Bucket.pde new file mode 100644 index 0000000..23d57be --- /dev/null +++ b/raindropGameCode/Bucket.pde @@ -0,0 +1,16 @@ +class Bucket { + PVector loc; + float diam; + PImage thompkins; + + Bucket() { + ellipse(mouseX-45,490,50,50); + loc = new PVector(mouseX,mouseY); + thompkins = loadImage("Thompkins.png"); + } + void display () { + imageMode(CENTER); + image(thompkins, mouseX, 490, 250, 250); + imageMode(CORNER); + } +} \ No newline at end of file diff --git a/raindropGameCode/Raindrop.pde b/raindropGameCode/Raindrop.pde new file mode 100644 index 0000000..48682f8 --- /dev/null +++ b/raindropGameCode/Raindrop.pde @@ -0,0 +1,32 @@ +class Raindrop { + PVector loc, vel, accel; + float diam, score; + + Raindrop (float x, float y) { + loc= new PVector(x, y); + vel= PVector.random2D(); + accel= new PVector (.5, 1); + } + void display () { + noStroke(); + fill(51, 0, 0); + ellipse(loc.x, loc.y, 70, 35); + } + + void fall () { + vel.add(accel); + loc.add(vel); + } + boolean isInContactWith(PVector thing) { + if (loc.dist(thing) <= 60) { + return true; + } else { + return false; + } + } + + void reset(float x) { + loc.set(x, 0); + vel = PVector.random2D(); + } +} \ No newline at end of file diff --git a/raindropGameCode/data/BUCKET.jpg b/raindropGameCode/data/BUCKET.jpg new file mode 100644 index 0000000..2afb81d Binary files /dev/null and b/raindropGameCode/data/BUCKET.jpg differ diff --git a/raindropGameCode/data/Jets.jpg b/raindropGameCode/data/Jets.jpg new file mode 100644 index 0000000..c761a38 Binary files /dev/null and b/raindropGameCode/data/Jets.jpg differ diff --git a/raindropGameCode/data/Thompkins.jpg b/raindropGameCode/data/Thompkins.jpg new file mode 100644 index 0000000..78252c6 Binary files /dev/null and b/raindropGameCode/data/Thompkins.jpg differ diff --git a/raindropGameCode/data/Thompkins.png b/raindropGameCode/data/Thompkins.png new file mode 100644 index 0000000..7ceb3f8 Binary files /dev/null and b/raindropGameCode/data/Thompkins.png differ diff --git a/raindropGameCode/data/football.png b/raindropGameCode/data/football.png new file mode 100644 index 0000000..4f18616 Binary files /dev/null and b/raindropGameCode/data/football.png differ diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index 944de61..b580b4c 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -1,5 +1,9 @@ PVector mouse; //declare a P -Raindrop r; //declare a new Raindrop called r +Raindrop r;//declare a new Raindrop called r +Bucket b; +PImage jets; +int score; +ArrayList raindrop = new ArrayList(); // On your own, create an array of Raindrop objects instead of just one // Use the array instead of the single object @@ -8,19 +12,41 @@ Raindrop r; //declare a new Raindrop called r void setup() { size(1200, 800); + jets = loadImage("Jets.jpg"); mouse = new PVector(); //initialize mouse PVector. value is irrelevant since it will be set at the start of void draw(){} - r = new Raindrop(random(width), 0); //Initialize r. The parameters used are the initial x and y positions + b = new Bucket(); + raindrop.add(new Raindrop(random(width), 0)); } + + + void draw() { - mouse.set(mouseX, mouseY); //set value of mouse as mouseX,mouseY - background(0, 200, 255); - r.fall(); //make the raindrop fall. It should accelerate as if pulled towards the ground by earth's gravity - r.display(); //display the raindrop - if (r.isInContactWith(mouse)) { //check to see if the raindrop is in contact with the point represented by the PVector called mouse - r.reset(); //if it is, reset the raindrop - } - if (r.loc.y > height + r.diam/2) { //check to see if the raindrop goes below the bottom of the screen - r.reset(); //if it does, reset the raindrop - } -} + image(jets, 0, 0, 1200, 800); + fill(145, 20, 0); + text("JETS BILLS 22", 50, 600, 300, 300); + text(score, 200, 660); + textSize(64); + mouse.set(mouseX, mouseY); //set value of mouse as mouseX,mouseY + b.display(); + for (int i = raindrop.size()-1; i >= 0; i--) { //go through the ArrayList backwards to prevent flickering + Raindrop r = raindrop.get(i); + r.fall(); //make the raindrop fall. It should accelerate as if pulled towards the ground by earth's gravity + r.display(); //display the raindrop + if (r.isInContactWith(mouse)) { //check to see if the raindrop is in contact with the point represented by the PVector called mouse + r.reset(random(0,750)); //if it is, reset the raindrop + score+=7; + } + if (r.loc.y > height + r.diam/2) { //check to see if the raindrop goes below the bottom of the screen + r.reset(random(0, 500)); //if it does, reset the raindrop + } + + if (score>= 28) { + background(0); + fill(0,255,0); + text("YOU BEAT THE BILLS 28-22!", 130, 250); + text("ON TO THE PLAYOFFS YOU GO!", 100,350); + textSize(32); + } + } +} \ No newline at end of file