diff --git a/raindropGameCode/Catcher_class.pde b/raindropGameCode/Catcher_class.pde new file mode 100644 index 0000000..4313c73 --- /dev/null +++ b/raindropGameCode/Catcher_class.pde @@ -0,0 +1,18 @@ +class Catcher { + PVector loc; //declare PVector for location of the catcher + PImage basket; //declare PImage variable for basket (which is the water bottle) + + Catcher() { + loc = new PVector(); //make the location of the updated catcher + basket = loadImage("water#1.png"); //bring in the water bottle image + } + + void display () { + image(basket, loc.x, loc.y); //make the water bottle image centered on the mouse + + } + + void update() { + loc.set(mouseX-40, mouseY-40); //when the catcher is updated, make its location the center of the image + } +} \ No newline at end of file diff --git a/raindropGameCode/data/DJ Khaled.jpg b/raindropGameCode/data/DJ Khaled.jpg new file mode 100644 index 0000000..70e9864 Binary files /dev/null and b/raindropGameCode/data/DJ Khaled.jpg differ diff --git a/raindropGameCode/data/LION.jpg b/raindropGameCode/data/LION.jpg new file mode 100644 index 0000000..1e084ca Binary files /dev/null and b/raindropGameCode/data/LION.jpg differ diff --git a/raindropGameCode/data/Steph-Curry.jpg b/raindropGameCode/data/Steph-Curry.jpg new file mode 100644 index 0000000..d10a6bf Binary files /dev/null and b/raindropGameCode/data/Steph-Curry.jpg differ diff --git a/raindropGameCode/data/key to success.png b/raindropGameCode/data/key to success.png new file mode 100644 index 0000000..f25d12f Binary files /dev/null and b/raindropGameCode/data/key to success.png differ diff --git a/raindropGameCode/data/nba basket.jpg b/raindropGameCode/data/nba basket.jpg new file mode 100644 index 0000000..eb2c162 Binary files /dev/null and b/raindropGameCode/data/nba basket.jpg differ diff --git a/raindropGameCode/data/nba basketball.jpg b/raindropGameCode/data/nba basketball.jpg new file mode 100644 index 0000000..2faa3e6 Binary files /dev/null and b/raindropGameCode/data/nba basketball.jpg differ diff --git a/raindropGameCode/data/played.jpg b/raindropGameCode/data/played.jpg new file mode 100644 index 0000000..900c4bb Binary files /dev/null and b/raindropGameCode/data/played.jpg differ diff --git a/raindropGameCode/data/water#1.png b/raindropGameCode/data/water#1.png new file mode 100644 index 0000000..0eed951 Binary files /dev/null and b/raindropGameCode/data/water#1.png differ diff --git a/raindropGameCode/data/water.jpg b/raindropGameCode/data/water.jpg new file mode 100644 index 0000000..087216e Binary files /dev/null and b/raindropGameCode/data/water.jpg differ diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde index 944de61..bbc0843 100644 --- a/raindropGameCode/raindropGameCode.pde +++ b/raindropGameCode/raindropGameCode.pde @@ -1,26 +1,66 @@ -PVector mouse; //declare a P -Raindrop r; //declare a new Raindrop called r - -// 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 +PVector mouse; //declare a PVector for mouse +ArrayList keys = new ArrayList(); +Catcher c; //declare catcher class +int score; //declare score variable +int screen; //declare screen variable +PImage bkgrnd; //declare background variable +PImage LION; //declare LION variable +PImage played; //declare played vartiable void setup() { - size(1200, 800); + size(1200, 800); //make a canvas 1200 across and 800 down 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 + c = new Catcher(); //initialize catcher class + score = 0; //set initial score to 0 + screen = 0; //make a circumstance for a situation to be true and thus allow something to happen once that situation is true + bkgrnd = loadImage("DJ Khaled.jpg"); //bring in DJ Khaled image + LION = loadImage("LION.jpg"); //bring in LION image + played = loadImage("played.jpg"); //bring in "Congrats, You Played Yourself Image } 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 + background(LION); //make the background=DJ Khaled's LION + fill(0); //give the text black fill + textSize(75); + text("Ride With Me on The Path", 200, 150); + text("to More Success", 300, 400); + text("*hold down any key", 300, 500); //draw text on start screen + keys.add(new Raindrop(random(width), 0)); //add more keys to the existing keys + if (keyPressed) { //if key is Pressed... + background(LION); //make background + textSize(75); + text("Notice How I Said More", 200, 300); + textSize(25); + text("Click to Receive As Many Keys to Success You Need", 225, 400); //more text that appears when any key is pressed + } + if (mousePressed) { //if mouse Pressed, a certain condition exists that allows for the game to occur + screen = 2; } - 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 + if (screen == 2) { //this condition is true, therefore sets everything in motion + background(bkgrnd); //use DJ Khaled background when mouse is Pressed + mouse.set(mouseX, mouseY); //set value of mouse as mouseX,mouseY + textSize(50); + text(score, 1100, 300); //display score (how many keys are in the catcher) + for (int i = keys.size()-1; i >= 0; i--) { + Raindrop k = keys.get(i); + c.display(); //display catcher + c.update(); + k.fall(); //make the keys to success fall + k.display(); //display te keys to success + if (k.Touches(c.loc)) { //if a key is touching the water bottle... + keys.remove(i); //remove the key touching the water bottle + score ++; //every time a key touches the water bottle, add 1 to the score + } + } + if (score > 200) { //if the score reaches 119, the game ends and a pic of Dj Khaled w/ his quote appears along with some text + theend(); //use theend function + } } } +void theend () { + background(played); //make the background the DJ Khaled Vine scene + textSize(35); + fill(38, 255, 217); //give the text a light blue color + text("Don't EVER Play Yourself", 100, 50); //end screen text +} \ No newline at end of file diff --git a/raindropGameCode/raindrop_class.pde b/raindropGameCode/raindrop_class.pde new file mode 100644 index 0000000..c5681af --- /dev/null +++ b/raindropGameCode/raindrop_class.pde @@ -0,0 +1,34 @@ +class Raindrop { + float diam; //declare diam + PVector vel, accel, loc; //declare PVector's for velocity, acceleration, and location of each key to success + PImage key; //declare PImage variable for the keys to success + + Raindrop(float a, float b) { + loc = new PVector(a, b); + vel = new PVector(0, 3); //assign velocity to each new Raindrop + accel = new PVector(0, random(.02, .08)); //assign acceleration to each new Raindrop + key = loadImage("key to success.png"); //bring in the key to success image + } + + void fall () { + loc.add(vel); //add velocity to the location of each Raindrop + vel.add(accel); //add acceleration to velocity of each Raindrop + } + + void display () { + image(key, loc.x, loc.y); //give the key to success image position + } + + boolean Touches(PVector z) { //set up true/false generator for conditions to be used in the main raindrop code + if (loc.dist(z) < 30) { //if the distance b/w PVector c and loc is less than 30, boolean e is true + return true; + } else { //else if not, boolean e is false + return false; + } + } + + void reset() { + loc.y = 0; //reset location of y to 0 and set a initial velocity b/w 0 and 7 + vel.set(0, 7); + } +} \ No newline at end of file