Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
9cdb4bd
Added Flowchart PDF
storm-lin Jan 11, 2016
5365983
file for game
allwhen Jan 11, 2016
a14b8c8
Merge remote-tracking branch 'refs/remotes/origin/master' into develo…
storm-lin Jan 11, 2016
0911889
Added a Controllable Character
storm-lin Jan 13, 2016
5651255
create a dodge class
kbeckford Jan 13, 2016
6ad7c0c
Added NPC Class
storm-lin Jan 13, 2016
e08c80f
started character class
mmansingh2 Jan 13, 2016
0108f9a
card class + card testing file
allwhen Jan 13, 2016
6bd42b0
Resolved Merge Conflict
storm-lin Jan 13, 2016
344b863
comments
allwhen Jan 13, 2016
bf09675
initializer with card position in it
allwhen Jan 13, 2016
0a81efb
fixed commas instead of semicolons
allwhen Jan 13, 2016
de255cd
Using Character Class in Main Class
storm-lin Jan 13, 2016
8a5f2f6
Merged from Storm
storm-lin Jan 13, 2016
2ad39b2
cards have different colored backs, touches function
allwhen Jan 13, 2016
1f0524c
Checks Collisions with NPCs
storm-lin Jan 13, 2016
d1cf024
Merge remote-tracking branch 'refs/remotes/origin/development'
storm-lin Jan 13, 2016
433916e
more organized placement
allwhen Jan 13, 2016
4c15787
Merge remote-tracking branch 'refs/remotes/origin/development' into S…
storm-lin Jan 13, 2016
dc4a1e6
after two cards are flipped, it resets to all face down.
allwhen Jan 14, 2016
0a8c811
Created Item Class, Renamed Charact File
storm-lin Jan 14, 2016
12452a1
Added Item Images and Interactions
storm-lin Jan 14, 2016
974d706
Merge remote-tracking branch 'refs/remotes/origin/master' into maya
storm-lin Jan 14, 2016
5648463
Merge remote-tracking branch 'refs/remotes/origin/master' into Storm
storm-lin Jan 14, 2016
45eb51c
Cards deleted after matching.
allwhen Jan 14, 2016
120b260
puzzle game
mmansingh2 Jan 14, 2016
7c0b520
riddle game
mmansingh2 Jan 14, 2016
a0f4e7a
Merge remote-tracking branch 'refs/remotes/origin/master' into develo…
storm-lin Jan 14, 2016
53dfd97
equals function added, better removal of cards
allwhen Jan 14, 2016
47f72e5
Prevents Player Walking Off of Screen
storm-lin Jan 14, 2016
94570b3
riddle game
mmansingh2 Jan 14, 2016
cf5f17c
Merge remote-tracking branch 'refs/remotes/origin/cards' into develop…
storm-lin Jan 14, 2016
9892abf
Merge branch 'development' of https://github.com/Albert-Wen-and-Co/Fi…
storm-lin Jan 14, 2016
b0ae8b0
Merge remote-tracking branch 'refs/remotes/origin/Storm' into develop…
storm-lin Jan 14, 2016
9b4bd7d
Merge remote-tracking branch 'refs/remotes/origin/maya' into development
storm-lin Jan 14, 2016
47e6881
Merge remote-tracking branch 'refs/remotes/origin/Kami' into development
storm-lin Jan 14, 2016
476ada3
Fixed Broken Code
storm-lin Jan 15, 2016
aab0a5f
Fixed More Broken Code
storm-lin Jan 15, 2016
07c1628
fixed merge conflict
kbeckford Jan 15, 2016
6740d48
create a bull and a bull system class
kbeckford Jan 15, 2016
3935cb1
Merge branch 'Kami' of https://github.com/Albert-Wen-and-Co/Final-Pro…
kbeckford Jan 15, 2016
fa60f30
Merge remote-tracking branch 'refs/remotes/origin/Kami' into development
kbeckford Jan 15, 2016
6ac23db
Fixed Even More Issues
storm-lin Jan 15, 2016
5bd42a7
new minigame
allwhen Jan 15, 2016
cba43a9
Merge remote-tracking branch 'refs/remotes/origin/development' into S…
storm-lin Jan 15, 2016
0d5cdba
resolved complex merge
kbeckford Jan 15, 2016
42759ae
Starts Game on Contact with NPC
storm-lin Jan 15, 2016
c8166ac
Finished resolving complex merge
kbeckford Jan 15, 2016
037f931
UI: add title screen (and title screen for bull game)
kbeckford Jan 20, 2016
5ad4be3
player character looks where he's going
allwhen Jan 20, 2016
5ac3fff
Items Now Appear in Order Collected
storm-lin Jan 20, 2016
51b7f2a
resolved merge conflict
kbeckford Jan 20, 2016
c54c301
Merge remote-tracking branch 'refs/remotes/origin/Aberts' into Storm
storm-lin Jan 20, 2016
3a2e019
Fixed Some Issues
storm-lin Jan 20, 2016
19cd5fa
Merge remote-tracking branch 'refs/remotes/origin/Storm' into develop…
storm-lin Jan 20, 2016
1a65c2f
Merge remote-tracking branch 'origin/development' into development
storm-lin Jan 20, 2016
1901191
Merge remote-tracking branch 'refs/remotes/origin/development' into S…
storm-lin Jan 20, 2016
4e2ee1d
Successful Interaction with Card Game
storm-lin Jan 20, 2016
c161bb8
Merge remote-tracking branch 'refs/remotes/origin/Storm' into develop…
storm-lin Jan 21, 2016
8317079
Dialog finally placed in those boxes.
allwhen Jan 21, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added FinalProjectFlowchart.pdf
Binary file not shown.
66 changes: 66 additions & 0 deletions Final_Project/Charact.pde
Original file line number Diff line number Diff line change
@@ -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;
}
}
139 changes: 139 additions & 0 deletions Final_Project/Final_Project.pde
Original file line number Diff line number Diff line change
@@ -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<Item> inventory = new ArrayList<Item>();

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();
}
}
16 changes: 16 additions & 0 deletions Final_Project/Item.pde
Original file line number Diff line number Diff line change
@@ -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);
}
}
18 changes: 18 additions & 0 deletions Final_Project/NPC.pde
Original file line number Diff line number Diff line change
@@ -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);
}
}
43 changes: 43 additions & 0 deletions Final_Project/bull_class.pde
Original file line number Diff line number Diff line change
@@ -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;
}
}

}
99 changes: 99 additions & 0 deletions Final_Project/bull_system.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
class Bullsystem {

ArrayList <Bulls> bull =new ArrayList<Bulls>();
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<count; i++) { //create an array
Bulls b=bull.get(i); //get the bulls from the array
b.fall(); //make the bull run to the bottom of the screen
b.display(); //display the raindrop
if (b.isInContactWith(mouse)) { //check to see if the bull is contact with the character
b.reset(); //if it is, reset the bull
scb=scb-1; //if a bull hits the character, the player looses a point
}
if (b.loc.y > 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
Loading