From 3fca21e09b3f19d09a56029791cdb7c94e3e07a6 Mon Sep 17 00:00:00 2001 From: Jmoose Date: Tue, 15 Dec 2015 09:23:44 -0500 Subject: [PATCH 1/5] is in contact with death --- raindropGameCode/Raindrop.pde | 32 +++++++++++++++++++++++++++ raindropGameCode/raindropGameCode.pde | 15 +++++++------ 2 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 raindropGameCode/Raindrop.pde diff --git a/raindropGameCode/Raindrop.pde b/raindropGameCode/Raindrop.pde new file mode 100644 index 0000000..11bfbc1 --- /dev/null +++ b/raindropGameCode/Raindrop.pde @@ -0,0 +1,32 @@ +class Raindrop { + color c; + int diam; + PVector loc, vel, g; //declare a P + + Raindrop(int tdiam) { + diam=30; + loc = new PVector(width/2, 50); + c=color(0, random(255), random(255)); + 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(PVector death) { + if (loc.dist(death) 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 } -} +} \ No newline at end of file From 89f87453ec94b3c6ad178f7e25b44d612863855d Mon Sep 17 00:00:00 2001 From: Jmoose Date: Thu, 17 Dec 2015 09:17:10 -0500 Subject: [PATCH 2/5] almost a catcher --- raindropGameCode/Raindrop.pde | 21 ++++++++++++++++++- raindropGameCode/raindropGameCode.pde | 30 +++++++++++++++++---------- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/raindropGameCode/Raindrop.pde b/raindropGameCode/Raindrop.pde index 11bfbc1..c0c9266 100644 --- a/raindropGameCode/Raindrop.pde +++ b/raindropGameCode/Raindrop.pde @@ -6,7 +6,7 @@ class Raindrop { Raindrop(int tdiam) { diam=30; loc = new PVector(width/2, 50); - c=color(0, random(255), random(255)); + c=color(0, random(150,255), random(10,100)); vel= PVector.random2D(); g= new PVector(0,.25); } @@ -29,4 +29,23 @@ class Raindrop { return true; }else{return false;} } +} + +class catcher{ + color c; + int diam; + PVector loc; + + catcher (int tdiam){ + c=color(0); + diam=75; + loc.x= mouseX; + loc.y=mouseY; + } + + void display(){ + fill(c); + noStroke(); + ellipse (loc.x,loc.y,diam,diam); + } } \ No newline at end of file diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index c7240f8..eaa14ad 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -1,6 +1,7 @@ +int co=20; PVector mouse; - Raindrop r; - + Raindrop[] r = new Raindrop[co]; +catcher bucket=new catcher; // On your own, create an array of Raindrop objects instead of just one // Use the array instead of the single object // You can start out by just using the single Raindrop as you test @@ -8,20 +9,27 @@ void setup() { size(600, 400); - mouse = new PVector(); //initialize mouse PVector. value is irrelevant since it will be set at the start of void draw(){} - r = new Raindrop (100); //Initialize r. The parameters used are the initial x and y positions -} +int i=0; +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 } - 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 + i++; } + } \ No newline at end of file From c0722be52670a3428807057aa5fe8555fdad2207 Mon Sep 17 00:00:00 2001 From: Jmoose Date: Thu, 17 Dec 2015 09:22:11 -0500 Subject: [PATCH 3/5] stufff ish i need to make a working catcher --- raindropGameCode/Raindrop.pde | 3 ++- raindropGameCode/raindropGameCode.pde | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/raindropGameCode/Raindrop.pde b/raindropGameCode/Raindrop.pde index c0c9266..0a8e252 100644 --- a/raindropGameCode/Raindrop.pde +++ b/raindropGameCode/Raindrop.pde @@ -31,7 +31,7 @@ class Raindrop { } } -class catcher{ +class Catcher{ color c; int diam; PVector loc; @@ -41,6 +41,7 @@ class catcher{ diam=75; loc.x= mouseX; loc.y=mouseY; + } void display(){ diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index eaa14ad..af34e1c 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -1,7 +1,7 @@ int co=20; PVector mouse; Raindrop[] r = new Raindrop[co]; -catcher bucket=new catcher; +Catcher b =new Catcher(); // On your own, create an array of Raindrop objects instead of just one // Use the array instead of the single object // You can start out by just using the single Raindrop as you test From e646526c16c2eed88dbf5e550226e0c075a58370 Mon Sep 17 00:00:00 2001 From: Jmoose Date: Tue, 5 Jan 2016 09:23:46 -0500 Subject: [PATCH 4/5] need to add the distance to the object --- raindropGameCode/Raindrop.pde | 21 ++++++---- raindropGameCode/raindropGameCode.pde | 56 ++++++++++++++++----------- 2 files changed, 46 insertions(+), 31 deletions(-) diff --git a/raindropGameCode/Raindrop.pde b/raindropGameCode/Raindrop.pde index 0a8e252..94b59c2 100644 --- a/raindropGameCode/Raindrop.pde +++ b/raindropGameCode/Raindrop.pde @@ -24,10 +24,12 @@ class Raindrop { loc.y=0; vel= PVector.random2D(); } - boolean isInContactWith(PVector death) { - if (loc.dist(death) 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++; - } - + 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++; + fill(0); //makes score black + textSize(30); // asigns score text size + text(score, width/2, height/2); // writes score + death.display(); + death.move(); +} } \ No newline at end of file From 0c4104200566a4b735c3a1d0c940de75dcb12c16 Mon Sep 17 00:00:00 2001 From: Jmoose Date: Wed, 6 Jan 2016 11:14:50 -0500 Subject: [PATCH 5/5] dern --- raindropGameCode/Raindrop.pde | 57 +++++++++++++-------------- raindropGameCode/raindropGameCode.pde | 48 +++++++++++----------- 2 files changed, 51 insertions(+), 54 deletions(-) diff --git a/raindropGameCode/Raindrop.pde b/raindropGameCode/Raindrop.pde index 94b59c2..b0d9925 100644 --- a/raindropGameCode/Raindrop.pde +++ b/raindropGameCode/Raindrop.pde @@ -1,14 +1,15 @@ + PVector loc, vel, g; //declare a P class Raindrop { color c; int diam; - PVector loc, vel, g; //declare a P + Raindrop(int tdiam) { diam=30; loc = new PVector(width/2, 50); - c=color(0, random(150,255), random(10,100)); + c=color(0, random(150, 255), random(10, 100)); vel= PVector.random2D(); - g= new PVector(0,.25); + g= new PVector(0, .25); } void display() { fill(c); @@ -16,42 +17,40 @@ class Raindrop { ellipse(loc.x, loc.y, diam, diam); } void fall() { - loc.add(vel); - vel.add(g); + 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() 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++; + 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(); - death.move(); -} + 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