diff --git a/FinalProjectFlowchart.pdf b/FinalProjectFlowchart.pdf new file mode 100644 index 0000000..c413341 Binary files /dev/null and b/FinalProjectFlowchart.pdf differ diff --git a/Final_Project/Charact.pde b/Final_Project/Charact.pde new file mode 100644 index 0000000..4d93861 --- /dev/null +++ b/Final_Project/Charact.pde @@ -0,0 +1,66 @@ +class Charact { + PVector loc; + float diam; + PImage cha = new PImage(); + + Charact(float x, float y) { + loc = new PVector (x, y); + diam = 40; + cha = loadImage("character down.png"); + cha.resize(60,50); + } + + void display() { + noFill(); + noStroke(); + ellipse(loc.x, loc.y, diam, diam); + image(cha, loc.x, loc.y); + } + + void move() { + if (keyPressed) + { + switch(keyCode) + { + case UP: + if (loc.y > diam/2) + { + loc.y -= 4; + cha = loadImage("character up.png"); + cha.resize(60,50); + } + break; + case DOWN: + if (loc.y < height - diam/2) + { + loc.y += 4; + cha = loadImage("character down.png"); + cha.resize(60,50); + } + break; + case LEFT: + if (loc.x > diam/2) + { + loc.x -= 4; + cha = loadImage("character left.png"); + cha.resize(50,60); + } + break; + case RIGHT: + if (loc.x < 1050 - diam/2) + { + loc.x += 4; + cha = loadImage("character right.png"); + cha.resize(50,60); + } + } + } + } + + boolean contact(PVector loc2) { + if (loc.dist(loc2) < diam) { + return true; + } + return false; + } +} \ No newline at end of file diff --git a/Final_Project/Final_Project.pde b/Final_Project/Final_Project.pde new file mode 100644 index 0000000..85f9999 --- /dev/null +++ b/Final_Project/Final_Project.pde @@ -0,0 +1,139 @@ +//declare variables +float playerX, playerY; +Charact c; +Bullsystem bs; +Charact p; +NPC[] people = new NPC[5]; +Item[] possibleItems = new Item[5]; +ArrayList inventory = new ArrayList(); + +PImage keys; +PImage character; +PImage logo; +PFont font; +PImage map; + +int gameScreen=0; //the correct screen is determined by the value of the variable, 0= initial screen, 1=game screen, 2=game over screen + +void setup() { + size(1200, 800);//set up canvas size + + font=loadFont("HVDBodedo.vlw"); //load fonts and images + character=loadImage("character down.png"); + character.resize(60,50); + logo=loadImage("mapquest(HVD).png"); + map=loadImage("mapbackground.jpg"); + map.resize(1200,800); + imageMode(CENTER); + p = new Charact(width/2, height/2);//initialize variables + people[0] = new NPC(width/2, height/2+100); + people[1] = new NPC(800, 100); + people[2] = new NPC(200, 400); + people[3] = new NPC(150, 300); + people[4] = new NPC(900, 500); + keys = loadImage("key.png"); + for (int i = 0; i < possibleItems.length; i++) + { + possibleItems[i] = new Item(keys); + } +} + +void draw() +{ + if (gameScreen == 0) { //if the value of variable is #, then the coresponding screen will show + initScreen(); + } else if (gameScreen == 1) { + gameScreen(); + } else if (gameScreen == 2) { + gameOverScreen(); + } + else if (gameScreen == 3) { + cardsDraw(); + } +} + +void initScreen(){ + fill(255); + rect(0,0,1200,800); + image(logo, width/2,300); + fill(0); + textFont(font, 35); + text("click anywhere to start!", width/2, 500); + textAlign(CENTER); +} + +void gameScreen(){ + background(0);//draw the background and sidebar + image(map,width/2,height/2); + fill(150); + rect(1050, 0, width, height); + + p.display(); + p.move(); + + for (int i = 0; i < people.length; i++)//draw each NPC + { + people[i].display(); + } + + for (int i = 0; i < people.length; i++)//check if the player is in contact with an NPC + { + if (p.contact(people[i].loc)) + { + fill(0);//replace this with something that starts a minigame + rect(0, 0, width, 50); + if(!hasItem(i)) + { + switch(i) + { + case 0: + textAlign(LEFT,TOP); + fill(255); + textSize(12); + text("Test you're memory and ability in this challenge. Press z to accept.",0,0); + if (key == 'z') { + cardsSetup(); + gameScreen = 3; + } + } + } + else { + textAlign(LEFT,TOP); + fill(255); + textSize(12); + text("Wow! You are so smart and intelligent and smart and smart. You may take my key.",0,0); + } + } + } + for(int i = 0; i < inventory.size(); i++) + { + Item tempItem = inventory.get(i); + tempItem.display(1100, 100 + 100 * i); + } +} + +boolean hasItem(int index) +{ + for(int i = 0; i < inventory.size(); i++) + { + Item tempItem = inventory.get(i); + if(tempItem == possibleItems[index]) + { + return true; + } + } + return false; +} + + void gameOverScreen(){ + } + + void startGame() { //set variable to start the game + gameScreen=1; +} + +public void mousePressed() { //the game will start if the mouse is pressed on the initial screen + if (gameScreen==0) { + startGame(); + } +} \ No newline at end of file diff --git a/Final_Project/Item.pde b/Final_Project/Item.pde new file mode 100644 index 0000000..c6817ab --- /dev/null +++ b/Final_Project/Item.pde @@ -0,0 +1,16 @@ +class Item +{ + boolean have; + PImage appearance; + + Item(PImage a) + { + appearance = a; + have = false; + } + + void display(float x, float y) + { + image(appearance, x, y, 50, 50); + } +} \ No newline at end of file diff --git a/Final_Project/NPC.pde b/Final_Project/NPC.pde new file mode 100644 index 0000000..86a81af --- /dev/null +++ b/Final_Project/NPC.pde @@ -0,0 +1,18 @@ +class NPC +{ + PVector loc; + float diam; + + NPC(float a, float b) + { + loc = new PVector(a, b); + diam = 40; + } + + void display() + { + fill(50, 50, 250); + stroke(0); + ellipse(loc.x, loc.y, diam, diam); + } +} \ No newline at end of file diff --git a/Final_Project/bull_class.pde b/Final_Project/bull_class.pde new file mode 100644 index 0000000..1179fee --- /dev/null +++ b/Final_Project/bull_class.pde @@ -0,0 +1,43 @@ +class Bulls { + PVector loc; //create a PVector for location of velocity + PVector vel; + float acc=.08; //initalize and define variables + float diam=25; + + + Bulls(float x, float y) { + //initialize all starting values + loc = new PVector(x, y); + vel = new PVector(0, .5); + } + + void display() { + //display bulls + fill(225,0,0); + ellipse(loc.x, loc.y, diam, diam); + + } + + void fall() { + //make the bull "run" to the bottom of the screen (fall) by adding acceleraltion to the velocity + vel.y += acc; + loc.add(vel); + } + + void reset() { + //return the bull back to the top of the screen at a random location. + loc.set(random(width), 0); + vel.set(0, .5); + acc=.1; + } + + boolean isInContactWith(PVector other) { + //if the bull touches the character,it will return to the top + if (loc.dist(other) <= diam/2+diam/2) { + return true; + } else { + return false; + } + } + +} \ No newline at end of file diff --git a/Final_Project/bull_system.pde b/Final_Project/bull_system.pde new file mode 100644 index 0000000..fa1d4a7 --- /dev/null +++ b/Final_Project/bull_system.pde @@ -0,0 +1,99 @@ +class Bullsystem { + + ArrayList bull =new ArrayList(); + int scb; + String time; + int t; + int count=5; + int interval; + PVector mouse; + int gameScreenB=0; + + + Bullsystem() { + scb=0; //delcare and italize variable for scoring + + time="32"; //create a string and interval to later create a countdown clock + t = 0; + interval=32; + mouse = new PVector(); + } + + void run() { + if (gameScreenB == 0) { //if the value of variable is #, then the coresponding screen will show + initScreenB(); + } else if (gameScreenB == 1) { + gameScreenB(); + } else if (t==0) { //when the time runs out, displat the game over screen + gameOverScreenB(); + } + } + + void initScreenB() { + //create a welcome screen + fill(0); + rect(0, 0, 1200, 800); + textFont(font, 45); + text("move your character to dodge any oncoming objects!", width/2, 300); + text("get hit less than 5 times and get the key! click to start!", width/2, 300); + } + + void gameScreenB() { + mouse.set(mouseX, mouseY); //set value of mouse as mouseX,mouseY + + //create a scoreboard + fill(0); + textFont(font, 15); + textAlign(CENTER); + text("Score:", 550, 765); + textSize(45); + text(scb, 610, 770); //display the score + + //create a timer + fill(0); + textFont(font, 15); + textAlign(CENTER); + text("Time Remaining:", 550, 730); + fill(255, 0, 0); + textFont(font, 45); + text(t, 645, 730); //display the time remaining + + t = interval-int(millis()/1000); //the clock will count down every second from the given interval + time = nf(t, 3); + + image(character, mouseX, mouseY); + + for (int i=0; i height + b.diam/2) { //check to see if the bull goes below the bottom of the screen + b.reset(); //if it does, it resets + } + } + } + + void gameOverScreenB() { + if (scb>= -5) { + textFont(font, 45); + text("congrats, you have recieved a KEY!", width/2, height/2); + textAlign(CENTER); + } else { + text("sorry, try again another time", width/2, height/2); + } + } + + void startGameB() { //set variable to start the game + gameScreenB=1; + } + + public void mousePressed() { //the game will start if the mouse is pressed on the initial screen + if (gameScreenB==0) { + startGameB(); + } + } +} //end of bull class parentheses \ No newline at end of file diff --git a/Final_Project/card_class.pde b/Final_Project/card_class.pde new file mode 100644 index 0000000..6bc96fd --- /dev/null +++ b/Final_Project/card_class.pde @@ -0,0 +1,48 @@ +class Card +{ + boolean up; + int id; + PVector pos = new PVector(); + + //creates card with desired id + Card(int tID) { + up = false; + id = tID; + pos.set(random(width-40),random(height-40)); + } + + Card(float x, float y, int tID) { + up = false; + id = tID; + pos.set(x,y); + } + + //flips the card + void flip() { + up = !up; + } + + //for now it just shows its number, but this should at some point change + void display() { + if(up) { + fill(255); + rect(pos.x,pos.y,40,40); + textAlign(CENTER,CENTER); + textSize(35); + fill(0); + text(id,pos.x+20,pos.y+20); + } + else { + fill(255,0,0); + rect(pos.x,pos.y,40,40); + } + } + + boolean touches(float x,float y) { + return x>pos.x&&xpos.y&&y cards = new ArrayList(); +ArrayList faceUp = new ArrayList(); +int moves = 0; +void cardsSetup() { + for (int i = 0; i<5; i++) { + Card a = new Card(100, 60*i, i); + cards.add(a); + } + + for (int i = 0; i<5; i++) { + Card a = new Card(300, 60*i, i); + cards.add(a); + } +} + + +void cardsDraw() { + background(0); + + //display of cards + for (int i = cards.size()-1; i >=0; i--) { + Card c = cards.get(i); + c.display(); + if (c.up) { + faceUp.add(c); + } + } + + //test if the two cards face up are same. If they are, then both cards are removed from original arraylist. + + if (faceUp.size() >=2) { + if (faceUp.get(0).equals(faceUp.get(1))) { + for (int j = cards.size()-1; j >=0; j--) { + Card d = cards.get(j); + if (d.id == faceUp.get(0).id) { + cards.remove(j); + if(cards.size() == 0){ + inventory.add(possibleItems[0]); + gameScreen = 1; + } + } + } + } + } + faceUp.clear(); +} + +void mouseClicked() { + for (int i = cards.size()-1; i >=0; i--) { + Card c = cards.get(i); + if (c.touches(mouseX, mouseY)) { //flips card when touching + if (moves%2==0) { //if two cards already up, flips them over before continuing. + for (int j = cards.size()-1; j >=0; j--) { + Card d = cards.get(j); + if (d.up) { + d.flip(); + } + } + } + c.flip(); + moves+=1; + } + } +} \ No newline at end of file diff --git a/Final_Project/cards_game/card_class.pde b/Final_Project/cards_game/card_class.pde new file mode 100644 index 0000000..3eab2c1 --- /dev/null +++ b/Final_Project/cards_game/card_class.pde @@ -0,0 +1,49 @@ +class Card +{ + boolean up; + int id; + PVector pos = new PVector(); + + //creates card with desired id + Card(int tID) { + up = false; + id = tID; + pos.set(random(width-40),random(height-40)); + } + + Card(float x, float y, int tID) { + up = false; + id = tID; + pos.set(x,y); + } + + //flips the card + void flip() { + up = !up; + return; + } + + //for now it just shows its number, but this should at some point change + void display() { + if(up) { + fill(255); + rect(pos.x,pos.y,40,40); + textAlign(CENTER); + fill(0); + text(id,pos.x+20,pos.y+20); + } + else { + fill(255,0,0); + rect(pos.x,pos.y,40,40); + } + return; + } + + boolean touches(float x,float y) { + return x>pos.x&&xpos.y&&y cards = new ArrayList(); +ArrayList faceUp = new ArrayList(); +int moves = 0; +void setup() { + size(800, 600); + for (int i = 0; i<5; i++) { + Card a = new Card(100, 60*i, i); + cards.add(a); + } + + for (int i = 0; i<5; i++) { + Card a = new Card(300, 60*i, i); + cards.add(a); + } +} + + +void draw() { + background(0); + + //display of cards + for (int i = cards.size()-1; i >=0; i--) { + Card c = cards.get(i); + c.display(); + if (c.up) { + faceUp.add(c); + } + } + + //test if the two cards face up are same. If they are, then both cards are removed from original arraylist. + + if (faceUp.size() >=2) { + if (faceUp.get(0).equals(faceUp.get(1))) { + for (int j = cards.size()-1; j >=0; j--) { + Card d = cards.get(j); + if (d.id == faceUp.get(0).id) { + cards.remove(j); + } + } + } + } + faceUp.clear(); +} + +void mouseClicked() { + for (int i = cards.size()-1; i >=0; i--) { + Card c = cards.get(i); + if (c.touches(mouseX, mouseY)) { //flips card when touching + if (moves%2==0) { //if two cards already up, flips them over before continuing. + for (int j = cards.size()-1; j >=0; j--) { + Card d = cards.get(j); + if (d.up) { + d.flip(); + } + } + } + c.flip(); + moves+=1; + } + } +} \ No newline at end of file diff --git a/Final_Project/data/HVDBodedo.vlw b/Final_Project/data/HVDBodedo.vlw new file mode 100644 index 0000000..e46250f Binary files /dev/null and b/Final_Project/data/HVDBodedo.vlw differ diff --git a/Final_Project/data/Thumbs.db b/Final_Project/data/Thumbs.db new file mode 100644 index 0000000..424c847 Binary files /dev/null and b/Final_Project/data/Thumbs.db differ diff --git a/Final_Project/data/character down.png b/Final_Project/data/character down.png new file mode 100644 index 0000000..ac9eec8 Binary files /dev/null and b/Final_Project/data/character down.png differ diff --git a/Final_Project/data/character left.fw.png b/Final_Project/data/character left.fw.png new file mode 100644 index 0000000..8795e51 Binary files /dev/null and b/Final_Project/data/character left.fw.png differ diff --git a/Final_Project/data/character left.png b/Final_Project/data/character left.png new file mode 100644 index 0000000..f3ec756 Binary files /dev/null and b/Final_Project/data/character left.png differ diff --git a/Final_Project/data/character right.fw.png b/Final_Project/data/character right.fw.png new file mode 100644 index 0000000..d7de1f3 Binary files /dev/null and b/Final_Project/data/character right.fw.png differ diff --git a/Final_Project/data/character right.png b/Final_Project/data/character right.png new file mode 100644 index 0000000..3504cd3 Binary files /dev/null and b/Final_Project/data/character right.png differ diff --git a/Final_Project/data/character up.fw.png b/Final_Project/data/character up.fw.png new file mode 100644 index 0000000..4b3454f Binary files /dev/null and b/Final_Project/data/character up.fw.png differ diff --git a/Final_Project/data/character up.png b/Final_Project/data/character up.png new file mode 100644 index 0000000..bbc58b2 Binary files /dev/null and b/Final_Project/data/character up.png differ diff --git a/Final_Project/data/key.png b/Final_Project/data/key.png new file mode 100644 index 0000000..0cc7473 Binary files /dev/null and b/Final_Project/data/key.png differ diff --git a/Final_Project/data/mapbackground.jpg b/Final_Project/data/mapbackground.jpg new file mode 100644 index 0000000..7ad8402 Binary files /dev/null and b/Final_Project/data/mapbackground.jpg differ diff --git a/Final_Project/data/mapquest(HVD).png b/Final_Project/data/mapquest(HVD).png new file mode 100644 index 0000000..7522137 Binary files /dev/null and b/Final_Project/data/mapquest(HVD).png differ diff --git a/Final_Project/dodging.pde b/Final_Project/dodging.pde new file mode 100644 index 0000000..25cac95 --- /dev/null +++ b/Final_Project/dodging.pde @@ -0,0 +1,44 @@ +class Dodge { + PVector loc; + PVector vel; + float diam=20; + float acc=.08; + float sc=0; + + Dodge(float x, float y) { + loc = new PVector(x, y); + vel = new PVector(0, .5); + } + + void display() { + fill(255, 0, 0); + ellipse(loc.x, loc.y, diam, diam); + } + + void fall() { + vel.y += acc; + loc.add(vel); + } + + void reset() { + loc.set(random(width), 0); + vel.set(0, .5); + acc=.1; + } + + boolean isInContactWith(PVector other) { + //if a falling object hits the person, it returns to the top + if (loc.dist(other) <= diam/2) { + return true; + } else { + return false; + } + } + + void score() { + if (isInContactWith(p.loc)) + { + sc=sc-1; + } + } +} \ No newline at end of file diff --git a/Final_Project/new_item.png b/Final_Project/new_item.png new file mode 100644 index 0000000..7d06c86 Binary files /dev/null and b/Final_Project/new_item.png differ diff --git a/Final_Project/puzzle_class.pde b/Final_Project/puzzle_class.pde new file mode 100644 index 0000000..6e13130 --- /dev/null +++ b/Final_Project/puzzle_class.pde @@ -0,0 +1,15 @@ +//class Block { +// PVector loc, wid, hei; + +// Block(float x, float y) { +// loc = new PVector(x, y); +// } + +// void display() { +// fill(139, 69, 19); +// rect(loc.x, loc.y, wid, hei); +// } + +// void move() { +// } +//} \ No newline at end of file diff --git a/Final_Project/puzzle_game.pde b/Final_Project/puzzle_game.pde new file mode 100644 index 0000000..e69de29 diff --git a/Final_Project/trial_of_finger_speed/trial_of_finger_speed.pde b/Final_Project/trial_of_finger_speed/trial_of_finger_speed.pde new file mode 100644 index 0000000..62028a5 --- /dev/null +++ b/Final_Project/trial_of_finger_speed/trial_of_finger_speed.pde @@ -0,0 +1,20 @@ +int score = 0; +float time = 10; +boolean start = false; +float startTime; +void setup() { + size(100,100); +} +void draw() { + if(!start) { + startTime = millis(); + } + background(0); + text(score, width/2,height/2); + text(time+startTime/1000-millis()/1000.0,width/2,height*3/4); +} + +void mouseClicked() { + start = true; + score+=1; +} \ No newline at end of file diff --git a/riddle_class/riddle_class.pde b/riddle_class/riddle_class.pde new file mode 100644 index 0000000..4fb874d --- /dev/null +++ b/riddle_class/riddle_class.pde @@ -0,0 +1,12 @@ +void setup(){ + size(1200,800); + background(0); +} + +void draw(){ + textSize(24); + textAlign(CENTER); + text("What number do you get when you multiply all of the numbers on a phone's number pad?", width/2, height/4); + fill(255,0,0); + +} \ No newline at end of file diff --git a/riddle_class/riddle_game.pde b/riddle_class/riddle_game.pde new file mode 100644 index 0000000..1b58d0d --- /dev/null +++ b/riddle_class/riddle_game.pde @@ -0,0 +1,20 @@ +class Rect{ + PVector loc; + float wid,hei; + String answer; + + + Rect(float x, float y) { + loc = new PVector(x,y); + wid = 100; + hei = 100; + + + } + + void display(){ + fill(0,255,0); + rect(loc.x,loc.y,wid,hei); + + } +} \ No newline at end of file