From 8ab3913df3b63ccfccf2225b89d736d459f140b4 Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 15 Dec 2015 08:48:29 -0500 Subject: [PATCH 01/18] Started things --- raindropGameCode/Raindropclass.pde | 15 +++++++++++++++ raindropGameCode/raindropGameCode.pde | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 raindropGameCode/Raindropclass.pde diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde new file mode 100644 index 0000000..5d47884 --- /dev/null +++ b/raindropGameCode/Raindropclass.pde @@ -0,0 +1,15 @@ +class Raindrop() { + PVector loc; + PVector vel; + float diam, locx, locy; + + Raindrop(float locx, float locy) { + loc = new PVector(locx, locy); + vel = new PVector(0, 1); + diam = 10; + } + void display() { + fill(0, 0, 255); + ellipse(loc.x, loc.y, diam, diam/2); + } +} \ No newline at end of file diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index 944de61..8b89c61 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -7,7 +7,7 @@ Raindrop r; //declare a new Raindrop called r void setup() { - size(1200, 800); + size(800, 800); 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 } @@ -23,4 +23,4 @@ void draw() { 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 } -} +} \ No newline at end of file From 078002141e866fdcdbdd231ea2ff57073ed0e648 Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 15 Dec 2015 09:13:43 -0500 Subject: [PATCH 02/18] Made 1 raindrop fall --- raindropGameCode/Raindropclass.pde | 22 ++++++++++++++++------ raindropGameCode/raindropGameCode.pde | 4 ++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index 5d47884..c9dad6b 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -1,15 +1,25 @@ -class Raindrop() { +class Raindrop { PVector loc; PVector vel; - float diam, locx, locy; + float diam, locx, locy, grav; Raindrop(float locx, float locy) { loc = new PVector(locx, locy); vel = new PVector(0, 1); diam = 10; + grav = 0.0981; } - void display() { - fill(0, 0, 255); - ellipse(loc.x, loc.y, diam, diam/2); - } + void fall() { + loc.add(vel); + vel.y += grav; + } + void display() { + fill(0, 0, 255); + ellipse(loc.x, loc.y, diam, diam/2); + } + /*void reset() { + } + boolean isInContactWith(PVector bucket){ + + }*/ } \ No newline at end of file diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index 8b89c61..b56b25b 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -17,10 +17,10 @@ void draw() { 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 + /*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 } -} \ No newline at end of file +*/} \ No newline at end of file From b1d609d6e659b024266b6c4aebc96649f5304fd4 Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 15 Dec 2015 09:19:34 -0500 Subject: [PATCH 03/18] Added reset --- raindropGameCode/Raindropclass.pde | 12 ++++++++---- raindropGameCode/raindropGameCode.pde | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index c9dad6b..4c4e7db 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -6,7 +6,7 @@ class Raindrop { Raindrop(float locx, float locy) { loc = new PVector(locx, locy); vel = new PVector(0, 1); - diam = 10; + diam = 25; grav = 0.0981; } void fall() { @@ -14,12 +14,16 @@ class Raindrop { vel.y += grav; } void display() { + noStroke(); fill(0, 0, 255); - ellipse(loc.x, loc.y, diam, diam/2); + ellipse(loc.x, loc.y, diam/2, diam); } - /*void reset() { + void reset() { + loc.x = random(width); + loc.y = 0; + vel.y = 1; } - boolean isInContactWith(PVector bucket){ + /*boolean isInContactWith(PVector bucket){ }*/ } \ No newline at end of file diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index b56b25b..c381742 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -7,7 +7,7 @@ Raindrop r; //declare a new Raindrop called r void setup() { - size(800, 800); + size(800, 600); 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 } @@ -19,8 +19,8 @@ void draw() { 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 } -*/} \ No newline at end of file +} \ No newline at end of file From 72dc36833433ded56ac72fbd210baf872a9c0e78 Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 15 Dec 2015 09:23:45 -0500 Subject: [PATCH 04/18] Attempted boolean true --- raindropGameCode/Raindropclass.pde | 10 ++++++---- raindropGameCode/raindropGameCode.pde | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index 4c4e7db..05d0d56 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -22,8 +22,10 @@ class Raindrop { loc.x = random(width); loc.y = 0; vel.y = 1; - } - /*boolean isInContactWith(PVector bucket){ - - }*/ + } + boolean isInContactWith(PVector thing) { + if (loc.dist(thing) 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 } From e6a52a5835e50fa859b5e3e1eadbf79124ac5a8e Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Thu, 17 Dec 2015 08:13:01 -0500 Subject: [PATCH 05/18] fixed boolean thing --- raindropGameCode/Raindropclass.pde | 2 ++ 1 file changed, 2 insertions(+) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index 05d0d56..0b443a0 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -26,6 +26,8 @@ class Raindrop { boolean isInContactWith(PVector thing) { if (loc.dist(thing) Date: Thu, 17 Dec 2015 09:07:53 -0500 Subject: [PATCH 06/18] started catcher class --- raindropGameCode/Raindropclass.pde | 13 +++++++++++++ raindropGameCode/raindropGameCode.pde | 4 +++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index 0b443a0..dba847c 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -30,4 +30,17 @@ class Raindrop { return false; } } +} + +class catcher { + PVector loc; + float diam; + + catcher(float tdiam){ + diam = tdiam; + } + void display(){ + fill(255,0,0); + ellipse(mouseX,mouseY, 40, 40); + } } \ No newline at end of file diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index c6c555a..00f59b8 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -1,5 +1,6 @@ PVector mouse; //declare a P Raindrop r; //declare a new Raindrop called r +catcher bucket; // On your own, create an array of Raindrop objects instead of just one // Use the array instead of the single object @@ -21,6 +22,7 @@ void draw() { 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 + r.reset(); //if it does, reset the raindrop + bucket.display(); } } \ No newline at end of file From 3eb02c912206cb33ad7731084e1d8e0959000041 Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 5 Jan 2016 08:00:47 -0500 Subject: [PATCH 07/18] idk i'm just saving it --- raindropGameCode/raindropGameCode.pde | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index 00f59b8..6f96b34 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -1,19 +1,16 @@ PVector mouse; //declare a P Raindrop r; //declare a new Raindrop called r catcher bucket; - -// 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 - +ArrayList raindrops = new ArrayList(); //declare and initialize the ArrayList void setup() { size(800, 600); 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 + raindrops.add(new Raindrop(mouseX, mouseY)); //add a new raindrop to the raindrop ArrayList } void draw() { + println(raindrops.size()); 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 From 2d91362e88bb21171a22967c34f89d21654804bf Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 5 Jan 2016 08:27:11 -0500 Subject: [PATCH 08/18] Fixed it --- raindropGameCode/Raindropclass.pde | 10 +++++----- raindropGameCode/raindropGameCode.pde | 25 ++++++++++++++++--------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index dba847c..201536d 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -35,12 +35,12 @@ class Raindrop { class catcher { PVector loc; float diam; - - catcher(float tdiam){ + + catcher(float tdiam) { diam = tdiam; } - void display(){ - fill(255,0,0); - ellipse(mouseX,mouseY, 40, 40); + void display() { + fill(255, 0, 0); + ellipse(mouseX, mouseY, 40, 40); } } \ No newline at end of file diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index 6f96b34..f8e6fdc 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -3,6 +3,7 @@ Raindrop r; //declare a new Raindrop called r catcher bucket; ArrayList raindrops = new ArrayList(); //declare and initialize the ArrayList + void setup() { size(800, 600); mouse = new PVector(); //initialize mouse PVector. value is irrelevant since it will be set at the start of void draw(){} @@ -10,16 +11,22 @@ void setup() { } void draw() { - println(raindrops.size()); + println(raindrops.size()); 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 - bucket.display(); +int i =0; + while (i < raindrops.size()) { + r = raindrops.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(); //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 + raindrops.add(new Raindrop(random(0, width), 0)); + //bucket.display(); + } + i ++; } } \ No newline at end of file From 74fbea6a7832b1aacd837bae94b00eb648785360 Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 5 Jan 2016 08:45:22 -0500 Subject: [PATCH 09/18] Make it bloody --- raindropGameCode/Raindropclass.pde | 6 ++--- raindropGameCode/raindropGameCode.pde | 34 ++++++++++++++++----------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index 201536d..44f9d93 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -15,8 +15,8 @@ class Raindrop { } void display() { noStroke(); - fill(0, 0, 255); - ellipse(loc.x, loc.y, diam/2, diam); + fill(255,0,0); + ellipse(loc.x, loc.y, 2*diam/3, diam); } void reset() { loc.x = random(width); @@ -41,6 +41,6 @@ class catcher { } void display() { fill(255, 0, 0); - ellipse(mouseX, mouseY, 40, 40); + rect(mouseX, mouseY, 40, 10); } } \ No newline at end of file diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index f8e6fdc..72782fe 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -7,26 +7,32 @@ ArrayList raindrops = new ArrayList(); //declare and init void setup() { size(800, 600); mouse = new PVector(); //initialize mouse PVector. value is irrelevant since it will be set at the start of void draw(){} - raindrops.add(new Raindrop(mouseX, mouseY)); //add a new raindrop to the raindrop ArrayList + raindrops.add(new Raindrop(width/2, mouseY)); //add a new raindrop to the raindrop ArrayList } void draw() { println(raindrops.size()); mouse.set(mouseX, mouseY); //set value of mouse as mouseX,mouseY background(0, 200, 255); -int i =0; + fill(204, 102, 0); + quad(0, 0, 0, 60, width, 40, width, 0); + int i =0; while (i < raindrops.size()) { - r = raindrops.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(); //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 - raindrops.add(new Raindrop(random(0, width), 0)); - //bucket.display(); - } - i ++; + r = raindrops.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 + raindrops.remove(i); //if it is, reset the raindrop raindrops.add(new Raindrop(random(0, width), 0)); + } + if (r.loc.y > height + r.diam/2) { //check to see if the raindrop goes below the bottom of the screen + raindrops.remove(i); //if it does, reset the raindrop + raindrops.add(new Raindrop(random(0, width), 0)); + float rand = random(1); + if (rand <= .25) { + raindrops.add(new Raindrop(random(0, width), 0)); + } + //bucket.display(); + } + i ++; } } \ No newline at end of file From e8ae62853141199c2b7dcf4eef5b4e01658d52c9 Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 5 Jan 2016 08:49:11 -0500 Subject: [PATCH 10/18] Made it bloodier --- raindropGameCode/Raindropclass.pde | 2 +- raindropGameCode/raindropGameCode.pde | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index 44f9d93..88f2173 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -15,7 +15,7 @@ class Raindrop { } void display() { noStroke(); - fill(255,0,0); + fill(200,0,0); ellipse(loc.x, loc.y, 2*diam/3, diam); } void reset() { diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index 72782fe..3f07e1a 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -28,7 +28,7 @@ void draw() { raindrops.remove(i); //if it does, reset the raindrop raindrops.add(new Raindrop(random(0, width), 0)); float rand = random(1); - if (rand <= .25) { + if (rand <= .75) { raindrops.add(new Raindrop(random(0, width), 0)); } //bucket.display(); From 12e9338f1bc27572caed3f6136437cb3354713cd Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 5 Jan 2016 08:55:51 -0500 Subject: [PATCH 11/18] I win, you lose --- raindropGameCode/raindropGameCode.pde | 40 +++++++++++++++------------ 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index 3f07e1a..f000f75 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -14,25 +14,31 @@ void draw() { println(raindrops.size()); mouse.set(mouseX, mouseY); //set value of mouse as mouseX,mouseY background(0, 200, 255); - fill(204, 102, 0); + fill(200, 102, 0); quad(0, 0, 0, 60, width, 40, width, 0); int i =0; while (i < raindrops.size()) { - r = raindrops.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 - raindrops.remove(i); //if it is, reset the raindrop raindrops.add(new Raindrop(random(0, width), 0)); - } - if (r.loc.y > height + r.diam/2) { //check to see if the raindrop goes below the bottom of the screen - raindrops.remove(i); //if it does, reset the raindrop - raindrops.add(new Raindrop(random(0, width), 0)); - float rand = random(1); - if (rand <= .75) { - raindrops.add(new Raindrop(random(0, width), 0)); - } - //bucket.display(); - } - i ++; + r = raindrops.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 + raindrops.remove(i); //if it is, reset the raindrop raindrops.add(new Raindrop(random(0, width), 0)); + } + if (r.loc.y > height + r.diam/2) { //check to see if the raindrop goes below the bottom of the screen + raindrops.remove(i); //if it does, reset the raindrop + raindrops.add(new Raindrop(random(0, width), 0)); + float rand = random(1); + if (rand <= .75) { + raindrops.add(new Raindrop(random(0, width), 0)); + } + //bucket.display(); + } + i ++; + if (i>= 500) { + background(255); + textSize(50); + text("Game Over, You Lose!", width/2, height/2); + textAlign(CENTER); + } } } \ No newline at end of file From 74d125cebb81ff3d74779929a2d5284f54668eda Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 5 Jan 2016 09:03:49 -0500 Subject: [PATCH 12/18] Please help --- raindropGameCode/raindropGameCode.pde | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index f000f75..e62e6a9 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -1,6 +1,6 @@ PVector mouse; //declare a P Raindrop r; //declare a new Raindrop called r -catcher bucket; +catcher tissue; ArrayList raindrops = new ArrayList(); //declare and initialize the ArrayList @@ -16,7 +16,7 @@ void draw() { background(0, 200, 255); fill(200, 102, 0); quad(0, 0, 0, 60, width, 40, width, 0); - int i =0; + int i = 0; while (i < raindrops.size()) { r = raindrops.get(i); r.fall(); //make the raindrop fall. It should accelerate as if pulled towards the ground by earth's gravity @@ -31,7 +31,6 @@ void draw() { if (rand <= .75) { raindrops.add(new Raindrop(random(0, width), 0)); } - //bucket.display(); } i ++; if (i>= 500) { From a720a20d71cc6ea8e7eea2fdf9a598be3e8ead7f Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 5 Jan 2016 09:07:09 -0500 Subject: [PATCH 13/18] Change to Blooddrop --- raindropGameCode/Raindropclass.pde | 4 ++-- raindropGameCode/raindropGameCode.pde | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index 88f2173..4127087 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -1,9 +1,9 @@ -class Raindrop { +class Blooddrop { //declare a class for the blood PVector loc; PVector vel; float diam, locx, locy, grav; - Raindrop(float locx, float locy) { + Blooddrop(float locx, float locy) { loc = new PVector(locx, locy); vel = new PVector(0, 1); diam = 25; diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index e62e6a9..a71e5a2 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -1,13 +1,13 @@ PVector mouse; //declare a P -Raindrop r; //declare a new Raindrop called r +Blooddrop r; //declare a new Raindrop called r catcher tissue; -ArrayList raindrops = new ArrayList(); //declare and initialize the ArrayList +ArrayList raindrops = new ArrayList(); //declare and initialize the ArrayList void setup() { size(800, 600); mouse = new PVector(); //initialize mouse PVector. value is irrelevant since it will be set at the start of void draw(){} - raindrops.add(new Raindrop(width/2, mouseY)); //add a new raindrop to the raindrop ArrayList + raindrops.add(new Blooddrop(width/2, mouseY)); //add a new raindrop to the raindrop ArrayList } void draw() { @@ -26,10 +26,10 @@ void draw() { } if (r.loc.y > height + r.diam/2) { //check to see if the raindrop goes below the bottom of the screen raindrops.remove(i); //if it does, reset the raindrop - raindrops.add(new Raindrop(random(0, width), 0)); + raindrops.add(new Blooddrop(random(0, width), 0)); float rand = random(1); if (rand <= .75) { - raindrops.add(new Raindrop(random(0, width), 0)); + raindrops.add(new Blooddrop(random(0, width), 0)); } } i ++; From b4a0d4abf5ddd48e54ffa3c8b769ce06d02b6742 Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 5 Jan 2016 09:09:59 -0500 Subject: [PATCH 14/18] sad --- raindropGameCode/raindropGameCode.pde | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index a71e5a2..e815b89 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -1,35 +1,35 @@ PVector mouse; //declare a P Blooddrop r; //declare a new Raindrop called r catcher tissue; -ArrayList raindrops = new ArrayList(); //declare and initialize the ArrayList +ArrayList blooddrops = new ArrayList(); //declare and initialize the ArrayList void setup() { size(800, 600); mouse = new PVector(); //initialize mouse PVector. value is irrelevant since it will be set at the start of void draw(){} - raindrops.add(new Blooddrop(width/2, mouseY)); //add a new raindrop to the raindrop ArrayList + blooddrops.add(new Blooddrop(width/2, mouseY)); //add a new raindrop to the raindrop ArrayList } void draw() { - println(raindrops.size()); + println(blooddrops.size()); mouse.set(mouseX, mouseY); //set value of mouse as mouseX,mouseY background(0, 200, 255); fill(200, 102, 0); quad(0, 0, 0, 60, width, 40, width, 0); int i = 0; - while (i < raindrops.size()) { - r = raindrops.get(i); + while (i < blooddrops.size()) { + r = blooddrops.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 - raindrops.remove(i); //if it is, reset the raindrop raindrops.add(new Raindrop(random(0, width), 0)); + blooddrops.remove(i); //if it is, reset the raindrop raindrops.add(new Raindrop(random(0, width), 0)); } if (r.loc.y > height + r.diam/2) { //check to see if the raindrop goes below the bottom of the screen - raindrops.remove(i); //if it does, reset the raindrop - raindrops.add(new Blooddrop(random(0, width), 0)); + blooddrops.remove(i); //if it does, reset the raindrop + blooddrops.add(new Blooddrop(random(0, width), 0)); float rand = random(1); if (rand <= .75) { - raindrops.add(new Blooddrop(random(0, width), 0)); + blooddrops.add(new Blooddrop(random(0, width), 0)); } } i ++; From c3caf90d40fd38d18db84f637f72fad28257bd5d Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Tue, 5 Jan 2016 09:24:17 -0500 Subject: [PATCH 15/18] Started to comment --- raindropGameCode/Raindropclass.pde | 16 ++++++++-------- raindropGameCode/raindropGameCode.pde | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index 4127087..28f27f2 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -1,13 +1,13 @@ class Blooddrop { //declare a class for the blood - PVector loc; - PVector vel; - float diam, locx, locy, grav; + PVector loc; //declare pvector for location + PVector vel; //declare pvector for velocity + float diam, locx, locy, grav; //declare diameter, x location, y location, and gravity - Blooddrop(float locx, float locy) { - loc = new PVector(locx, locy); - vel = new PVector(0, 1); - diam = 25; - grav = 0.0981; + Blooddrop(float locx, float locy) { //make a blooddrop at the location the user chooses + loc = new PVector(locx, locy); //make the location be + vel = new PVector(0, 1); //velocity + diam = 25; //diameter of the blooddrop is 25 + grav = 0.0981; //gravity of the blooddrop is actual gravity } void fall() { loc.add(vel); diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index e815b89..cd0f895 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -34,8 +34,9 @@ void draw() { } i ++; if (i>= 500) { - background(255); + background(0); textSize(50); + fill(200,0,0); text("Game Over, You Lose!", width/2, height/2); textAlign(CENTER); } From b846217e8d48eb451b45e5fdaf822c7bc7a8261f Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Mon, 11 Jan 2016 08:41:02 -0500 Subject: [PATCH 16/18] Added catcher and starting blood drops --- raindropGameCode/Raindropclass.pde | 23 +++++++++++++++++++---- raindropGameCode/raindropGameCode.pde | 9 ++++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index 28f27f2..b77a7d5 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -34,13 +34,28 @@ class Blooddrop { //declare a class for the blood class catcher { PVector loc; - float diam; + int w,h; - catcher(float tdiam) { - diam = tdiam; + catcher() { + loc = new PVector(); + w = 50; + h= 20; } void display() { + rectMode(CENTER); fill(255, 0, 0); - rect(mouseX, mouseY, 40, 10); + rect(loc.x, loc.y, w, h); } + void update(){ + loc.set(mouseX, mouseY); + } + boolean isCatching(){ + if (blooddrops.loc.x + blooddrops.diam/2 > loc.x - w/2 && blooddrops.loc.x - blooddrops.diam/2 < loc.x + w/2 && blooddrops.loc.y + blooddrops.diam/2 > loc.y - h/2 && blooddrops.loc.y - blooddrops.diam/2 < loc.y + h/2) { + return true; + }else{ + return false; + } + } + + } \ No newline at end of file diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index cd0f895..e1cf341 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -2,12 +2,19 @@ PVector mouse; //declare a P Blooddrop r; //declare a new Raindrop called r catcher tissue; ArrayList blooddrops = new ArrayList(); //declare and initialize the ArrayList - +int startingBlood = 4; void setup() { size(800, 600); mouse = new PVector(); //initialize mouse PVector. value is irrelevant since it will be set at the start of void draw(){} blooddrops.add(new Blooddrop(width/2, mouseY)); //add a new raindrop to the raindrop ArrayList +tissue = new catcher(); + +for (int i = 0; i < startingBlood; i++) { + +blooddrops.add(new Blooddrop(random(width), random(height))); + +} } void draw() { From 21f8255fc38a61bd5313f3de70cde186f38d0932 Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Mon, 11 Jan 2016 08:54:58 -0500 Subject: [PATCH 17/18] Fixed catcher --- raindropGameCode/Raindropclass.pde | 6 +++--- raindropGameCode/raindropGameCode.pde | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index b77a7d5..adc76f3 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -43,14 +43,14 @@ class catcher { } void display() { rectMode(CENTER); - fill(255, 0, 0); + fill(255); rect(loc.x, loc.y, w, h); } void update(){ loc.set(mouseX, mouseY); } - boolean isCatching(){ - if (blooddrops.loc.x + blooddrops.diam/2 > loc.x - w/2 && blooddrops.loc.x - blooddrops.diam/2 < loc.x + w/2 && blooddrops.loc.y + blooddrops.diam/2 > loc.y - h/2 && blooddrops.loc.y - blooddrops.diam/2 < loc.y + h/2) { + boolean isCatching(Blooddrop droplet){ + if (droplet.loc.x + droplet.diam/2 > loc.x - w/2 && droplet.loc.x - droplet.diam/2 < loc.x + w/2 && droplet.loc.y + droplet.diam/2 > loc.y - h/2 && droplet.loc.y - droplet.diam/2 < loc.y + h/2) { return true; }else{ return false; diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index e1cf341..e2f92a8 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -2,7 +2,7 @@ PVector mouse; //declare a P Blooddrop r; //declare a new Raindrop called r catcher tissue; ArrayList blooddrops = new ArrayList(); //declare and initialize the ArrayList -int startingBlood = 4; +int startingBlood = 3; void setup() { size(800, 600); @@ -24,6 +24,7 @@ void draw() { fill(200, 102, 0); quad(0, 0, 0, 60, width, 40, width, 0); int i = 0; + tissue.display(); while (i < blooddrops.size()) { r = blooddrops.get(i); r.fall(); //make the raindrop fall. It should accelerate as if pulled towards the ground by earth's gravity @@ -39,6 +40,13 @@ void draw() { blooddrops.add(new Blooddrop(random(0, width), 0)); } } + if (tissue.isCatching(r)) { + +blooddrops.remove(i); + +blooddrops.add(new Blooddrop(random(width), random(height))); + +} i ++; if (i>= 500) { background(0); From 6f0ec740493d25576c5955fd81b59a815fb5a760 Mon Sep 17 00:00:00 2001 From: AmandaLJuniorTech Date: Mon, 11 Jan 2016 09:01:47 -0500 Subject: [PATCH 18/18] Almost done --- raindropGameCode/Raindropclass.pde | 2 +- raindropGameCode/raindropGameCode.pde | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/raindropGameCode/Raindropclass.pde b/raindropGameCode/Raindropclass.pde index adc76f3..5ae1a8c 100644 --- a/raindropGameCode/Raindropclass.pde +++ b/raindropGameCode/Raindropclass.pde @@ -38,7 +38,7 @@ class catcher { catcher() { loc = new PVector(); - w = 50; + w = 100; h= 20; } void display() { diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index e2f92a8..17fa95e 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -2,7 +2,7 @@ PVector mouse; //declare a P Blooddrop r; //declare a new Raindrop called r catcher tissue; ArrayList blooddrops = new ArrayList(); //declare and initialize the ArrayList -int startingBlood = 3; +int startingBlood = 2; void setup() { size(800, 600); @@ -24,6 +24,7 @@ void draw() { fill(200, 102, 0); quad(0, 0, 0, 60, width, 40, width, 0); int i = 0; + tissue.update(); tissue.display(); while (i < blooddrops.size()) { r = blooddrops.get(i); @@ -44,7 +45,7 @@ void draw() { blooddrops.remove(i); -blooddrops.add(new Blooddrop(random(width), random(height))); +blooddrops.add(new Blooddrop(random(width),0)); } i ++;