diff --git a/raindropGameCode/Meatgame/Catch.pde b/raindropGameCode/Meatgame/Catch.pde new file mode 100644 index 0000000..636b1fc --- /dev/null +++ b/raindropGameCode/Meatgame/Catch.pde @@ -0,0 +1,22 @@ +class catCher { + int diam; + color c; + PVector loc; + + catCher(float x, float y) + { + diam = 100; + loc = new PVector (x, y); + } + + void display() { + noFill(); + noStroke(); + ellipse(loc.x, loc.y, diam, diam); + } + + + void update() { + loc.set(mouseX, mouseY); + } +} \ No newline at end of file diff --git a/raindropGameCode/Meatgame/Chunks.pde b/raindropGameCode/Meatgame/Chunks.pde new file mode 100644 index 0000000..afce84d --- /dev/null +++ b/raindropGameCode/Meatgame/Chunks.pde @@ -0,0 +1,37 @@ +class Raindrop { + PVector loc, vel, accel; + float diam; + float hue, sat, bright, alpha; + color c; + + Raindrop(float x, float y) + { + diam = random(30); + loc = new PVector (x, y); + vel = new PVector (0, random(6, 8 )); + c = color(150, 0, 0); + } + + void display() { + fill(c); + stroke(90,0,0); + strokeWeight(5); + ellipse(loc.x, loc.y, diam, diam); + } + + void fall() { + loc.add(vel); + } + + boolean isInContactWith(catCher killer) { //function to check if the raindrop is in contact with the point represented by the PVector called killer + if (loc.dist(killer.loc) < diam/2+killer.diam/2) { + return true; + } else { + return false; + } + } + + void reset(){ + loc.set(random(200,500), random(-1000, 0)); +} +} \ No newline at end of file diff --git a/raindropGameCode/Meatgame/Meatgame.pde b/raindropGameCode/Meatgame/Meatgame.pde new file mode 100644 index 0000000..81716e6 --- /dev/null +++ b/raindropGameCode/Meatgame/Meatgame.pde @@ -0,0 +1,154 @@ +PVector mouse; +catCher k; +boolean active; +ArrayList raindrop = new ArrayList(); //declare and initialize ArrayList Raindrop (Names weren't changed for the sake of convenience...) +int score; +PImage bag; +PImage bag2; +boolean timeStart = false; +float time; +PImage titleTiger; +PImage wood1; +PImage snarl; +boolean loser = false; +int screen = 0; // switches between codes for each screen when value is changed by mousepressed function +PImage safe; + +void setup() { + size(1200, 800); + mouse = new PVector(); + raindrop.add(new Raindrop(random(200, 500), random(-1000, 0))); //adds a new raindrop to the Raindrop ArrayList + k = new catCher(mouseX, mouseY); + score = 0; + bag = loadImage("bag.jpg"); + bag2 = loadImage("bag2.jpg"); + time = 60; + titleTiger = loadImage("ttiger.jpg"); + wood1 = loadImage("wood1.jpg"); + snarl = loadImage("snarl.jpg"); + safe = loadImage("safe.jpg"); +} + +void draw() { + // Screen 0 displays the start screen + if (screen == 0) { + background(0); + image(titleTiger, 80, 0); + fill(random(255), random(95), 0); + textSize(100); + text("Feed", 10, 100); + text("The", 1000, 100); + text("TIGER", 530, 620); + fill(255, 0, 0); + textSize(40); + text("Catch 1000 scraps of meat in the paper bag...", 185, 660); + text("Drag slowly or they'll fall out.", 300, 700); + text("Shake the meat out of the bag into the cage.", 190, 735); + text("Don't make him wait too long.", 290, 770); + fill(255, 103, 0); + textSize(20); + text("Click to Pause", 520, 790); + textSize(100); + } else if (screen == 1) { + +// Screen 1 is the game screen + background(wood1); + mouse.set(mouseX, mouseY); + k.update(); // updates object k's location to mouse's location + if (timeStart == true) { + time = time - 0.020; + } + if (time < 20.000 && score < 1000) { + fill(90, 0, 0); + textSize(50); + text("*Growl*", 800, 550); + } + if (time < 10.000 && score < 1000) { + fill(90, 0, 0); + textSize(80); + text("*ROAR*", 600, 300); + } + + textSize(40); + fill(255, 0, 0); + text(time, 0, 250); + fill(88, 64, 27); + textSize(50); + text(score, 1000, 50); + image(bag, mouseX - 50, mouseY - 60); + if (mouseX > 800) { + image(bag2, mouseX - 50, mouseY - 60); + } + raindrop.add(new Raindrop(random(200, 500), random(-1000, 0))); //adds a new raindrop to the Raindrop ArrayList + + for (int i = raindrop.size()-1; i >= 0; i--) + { + Raindrop r = raindrop.get(i); // Gets raindrop at index 0/location i from ArrayList and stores it as Raindrop r + r.fall(); // makes r "fall" + r.display(); // displays r + if (r.isInContactWith(k)) { // when Raindrop r is in contact (if the distance between the centers is less than k's radius plus r's radius) with k (object from the catCher class) + active = true; // boolean that when true sets r's location at the mouse aka in the bag + if (active = true) { + r.loc.set(mouseX, mouseY); + } + } + if (r.loc.y > height + r.diam/2) { //if r falls past the bottom of the screen, it is removed from the Arraylist + raindrop.remove(i); + } + if (r.loc.x > 900 && r.loc.y > height) // if r enters the "cage" represented by rectangles at the bottom right of the game screen, 1 is added to the score until it falls below the screen (to make obtaining a score of 1000 easier) + { + score = score + 1; + } + } + k.display(); // displaying object k from the class catCher + stroke(64, 64, 64); + fill(96, 96, 96); + rect(800, 600, 400, 20); + rect(850, 620, 20, 200); + rect(900, 620, 20, 200); + rect(950, 620, 20, 200); + rect(1000, 620, 20, 200); + rect(1050, 620, 20, 200); + rect(1100, 620, 20, 200); + rect(1150, 620, 20, 200); + if (time < 00.000 && score < 1000) // if the time reaches 0 and the score is still below 1000, screen 2 (the losing screen) is displayed + { + screen = 2; + } + + if (time < 00.00 && score >= 1000) { // if the time reaches 0 and the score is or is above 1000, screen 3(the winning screen) is displayed + screen = 3; + } + + } else if (screen == 2) { + image(snarl, 0, 0); + fill(255, 0, 0); + textSize(100); + text("YOU ARE DEAD", 200, 200); + } else if (screen == 3) { + image(safe, 0, 0); + fill(88, 64, 27); + textSize(50); + text("You Are Safe For the Time Being.", 200, 750); + } else if (screen == 4) { + //pause screen + } +} + + +void mousePressed() // it is mousePressed that changes the value of screen, skipping to the block of codes of each screen +{ + if (screen == 0) { + screen = 1; + timeStart = !timeStart; // boolean that starts the timer + } else if (screen == 1) { + screen = 4; + } else if (screen == 4) { + screen = 1; + } else if (screen == 3 || screen == 2) { + screen = 0; + time = 60.000; + score = 0; + timeStart = !timeStart; + } +} \ No newline at end of file diff --git a/raindropGameCode/Meatgame/data/bag.jpg b/raindropGameCode/Meatgame/data/bag.jpg new file mode 100644 index 0000000..2b09fdf Binary files /dev/null and b/raindropGameCode/Meatgame/data/bag.jpg differ diff --git a/raindropGameCode/Meatgame/data/bag2.jpg b/raindropGameCode/Meatgame/data/bag2.jpg new file mode 100644 index 0000000..459cc91 Binary files /dev/null and b/raindropGameCode/Meatgame/data/bag2.jpg differ diff --git a/raindropGameCode/Meatgame/data/safe.jpg b/raindropGameCode/Meatgame/data/safe.jpg new file mode 100644 index 0000000..a1bc00c Binary files /dev/null and b/raindropGameCode/Meatgame/data/safe.jpg differ diff --git a/raindropGameCode/Meatgame/data/snarl.jpg b/raindropGameCode/Meatgame/data/snarl.jpg new file mode 100644 index 0000000..c718aac Binary files /dev/null and b/raindropGameCode/Meatgame/data/snarl.jpg differ diff --git a/raindropGameCode/Meatgame/data/ttiger.jpg b/raindropGameCode/Meatgame/data/ttiger.jpg new file mode 100644 index 0000000..d854d3c Binary files /dev/null and b/raindropGameCode/Meatgame/data/ttiger.jpg differ diff --git a/raindropGameCode/Meatgame/data/wood.jpg b/raindropGameCode/Meatgame/data/wood.jpg new file mode 100644 index 0000000..1758d50 Binary files /dev/null and b/raindropGameCode/Meatgame/data/wood.jpg differ diff --git a/raindropGameCode/Meatgame/data/wood1.jpg b/raindropGameCode/Meatgame/data/wood1.jpg new file mode 100644 index 0000000..2761ce2 Binary files /dev/null and b/raindropGameCode/Meatgame/data/wood1.jpg differ diff --git a/raindropGameCode/raindropGameCode.pde b/raindropGameCode/raindropGameCode.pde deleted file mode 100644 index 944de61..0000000 --- a/raindropGameCode/raindropGameCode.pde +++ /dev/null @@ -1,26 +0,0 @@ -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 - - -void setup() { - size(1200, 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 -} - -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 - } -}