diff --git a/raindropGameCode/Raindrop.pde b/raindropGameCode/Raindrop.pde new file mode 100644 index 0000000..b0d9925 --- /dev/null +++ b/raindropGameCode/Raindrop.pde @@ -0,0 +1,56 @@ + PVector loc, vel, g; //declare a P +class Raindrop { + color c; + int diam; + + + Raindrop(int tdiam) { + diam=30; + loc = new PVector(width/2, 50); + c=color(0, random(150, 255), random(10, 100)); + vel= PVector.random2D(); + g= new PVector(0, .25); + } + void display() { + fill(c); + noStroke(); + ellipse(loc.x, loc.y, diam, diam); + } + void fall() { + loc.add(vel); + vel.add(g); + } + void reset() { + loc.x=random(width); + loc.y=0; + vel= PVector.random2D(); + } +} + boolean isInContactWith(Catcher death) { + if ( loc.dist(mouse) 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 + mouse.set(mouseX, mouseY); //set mouse as a vector + int i=0; //make i a zero for the block of code + background(0, 100, 255); //set blue colored background + while (i height + r[i].diam/2) { //check to see if the raindrop goes below the bottom of the screen + r[i].reset(); //if it does, reset the raindrop + } + i++; //add one to i to keep the raindrops functioning + fill(0); //makes score black + textSize(30); // asigns score text size + text(score, width/2, height/2); // writes score + death.display(); // display the shape death + death.move(); //make death move + if(score = 30){ + background(0); + text("you win",300,200); + } } -} +} \ No newline at end of file