//Greg Batha - Project 1
//DESMA 28 Interactivity
//MOST RECENT UPDATE AS OF 11/3/08
//If game is resetting strangely, refresh the page
//variables to control the game mode
int storyPage;
int gamePage;
boolean playTime;
int caughtMode;
PFont font;
//declares background images
PImage bg1;
PImage bg2;
PImage bg4;
PImage currentBG;
PImage title;
//declares highlights for title screen
PImage easy;
PImage med;
PImage hard;
//declares character sprites
PImage gill_left;
PImage gill_right;
PImage littleFish_left;
PImage littleFish_right;
PImage thugFish_left;
PImage thugFish_right;
PImage octopus;
PImage stan_left;
PImage stan_right;
PImage tony_left;
PImage tony_right;
//declares images for caught game
PImage caught0;
PImage caught1;
PImage caught2;
PImage caught3;
PImage caught4;
PImage caught5;
float markTime;
//declares character objects
Gill gill;
NPC oct;
NPC tony;
NPC stan;
NPC thg;
NPC thg1;
NPC thg2;
NPC thg3;
NPC kid;
//declares other objects
Dialog dialog;
void setup(){
size(600, 400);
smooth();
font = loadFont("Arial-BoldMT-48.vlw");
//sets game-controlling variables
storyPage = 0;
gamePage = 0;
playTime = false;
caughtMode = 0;
//loads all background graphics
bg1 = loadImage("bg1.jpg");
bg2 = loadImage("bg2.jpg");
bg4 = loadImage("bg4.jpg");
currentBG = bg1;
title = loadImage("title.jpg");
//loads highlights for title screen
easy = loadImage("easy.png");
med = loadImage("medium.png");
hard = loadImage("hard.png");
//loads caught minigame arrows
caught0 = loadImage("caught0.png");
caught1 = loadImage("caught1.png");
caught2 = loadImage("caught2.png");
caught3 = loadImage("caught3.png");
caught4 = loadImage("caught4.png");
caught5 = loadImage("caught5.png");
gill_right = loadImage("gill.png");
gill_left = loadImage("gill_left.png");
littleFish_right = loadImage("littlefish.png");
littleFish_left = loadImage("littlefish_left.png");
thugFish_right = loadImage("punk.png");
thugFish_left = loadImage("punk_left.png");
octopus = loadImage("octopus.png");
tony_right = loadImage("tony.png");
tony_left = loadImage("tony_left.png");
stan_right = loadImage("stan.png");
stan_left = loadImage("stan_left.png");
//creates all objects
gill = new Gill(150, gill_left, gill_right, 0.05, 20);
oct = new NPC(400, 0.005, octopus, octopus, 291, 281, 100, 1500, gill);
tony = new NPC(100, 0.028, tony_left, tony_right, 50, 17, 10, 300, gill);
stan = new NPC(100, 0.018, stan_left, stan_right, 47, 30, 5, 150, gill);
thg = new NPC(300, 0.01, thugFish_left, thugFish_right, 168, 100, 30, 1000, gill);
thg3 = new NPC(600, 0.01, thugFish_left, thugFish_right, 168, 100, 80, 1000, gill);
thg2 = new NPC(600, 0.01, thugFish_left, thugFish_right, 168, 100, 80, 1000, gill);
thg1 = new NPC(300, 0.01, thugFish_left, thugFish_right, 168, 100, 50, 1000, gill);
kid = new NPC(150, 0.01, littleFish_left, littleFish_right, 56, 30, 10, 1000, gill);
dialog = new Dialog();
}
void draw(){
background(currentBG);
progressStory();
if(playTime == false){
dialog.display();
}
//declares Tony and Stan's targetX targetY, always constant
tony.targetX = gill.x;
stan.targetX = gill.x;
tony.targetY = gill.y - 50;
stan.targetY = gill.y + 30;
//draws the highlights for the difficulty selection
if(storyPage == 0){
if(mouseY > 310 && mouseY < 350){
if(mouseX > 40 && mouseX < 130){
image(easy, 0, 0);
}
if(mouseX > 230 && mouseX < 370){
image(med, 0, 0);
}
if(mouseX > 470 && mouseX < 555){
image(hard, 0, 0);
}
}
}
}
void progressStory(){
//defaults to the title page
if(storyPage == 0){
playTime = true;
image(title, 0,0);
dialog.n = 1;
}
//gamePage 1
if(gamePage == 1 && playTime == true){
if(gill.x + gill.gill_sprite.width/2 > 600){
playTime = false;
storyPage = 8;
dialog.n = 19;
currentBG = bg2;
}
if(oct.HP == 0){
playTime = false;
oct.charWidth = oct.origCharWidth;
oct.charHeight = oct.origCharHeight;
gill.strength += 5;
gill.HP += 25;
dialog.n= 6;
storyPage = 2;
}
else if(gill.HP ==0){
playTime = false;
oct.charWidth = oct.origCharWidth;
oct.charHeight = oct.origCharHeight;
dialog.n = 4;
storyPage = 3;
}
else if(oct.HP > 0 && gill.HP > 0){
oct.move();
if(oct.HP < oct.maxHP){
oct.attack();
}
oct.display();
gill.move();
noTint();
gill.display();
tony.move();
tony.display();
stan.move();
stan.display();
}
}
//gamePage 2
if(gamePage == 2 && playTime == true){
gill.display();
stan.display();
tony.display();
float m = millis();
//displays timer
textFont(font);
textSize(48);
fill(255);
if(m < markTime +1000){
text("5", 550, 50);
}
else if(m < markTime + 2000){
text("4", 550, 50);
}
else if(m < markTime + 3000){
text("3", 550, 50);
}
else if(m < markTime + 4000){
text("2", 550, 50);
}
else if(m < markTime + 5000){
text("1", 550, 50);
}
else if(m < markTime + 6000){
text("0", 550, 50);
}
//checks caughtMode
if(markTime + 6000> m){
if(caughtMode == 0){
image(caught0, 32, 100);
}
if(caughtMode == 1){
image(caught1, 32, 100);
}
if(caughtMode == 2){
image(caught2, 32, 100);
}
if(caughtMode == 3){
image(caught3, 32, 100);
}
if(caughtMode == 4){
image(caught4, 32, 100);
}
if(caughtMode == 5){
image(caught5, 32, 100);
storyPage = 5;
gill.HP = gill.maxHP;
currentBG = bg4;
playTime = false;
dialog.n = 12;
}
}
else{
playTime = false;
dialog.n = 11;
storyPage = 4;
}
}
//gamePage 3
if(gamePage == 3 && playTime == true){
if(thg1.HP == 0 || thg2.HP == 0 || thg3.HP == 0){
playTime = false;
thg1.charWidth = thg1.origCharWidth;
thg1.charHeight = thg1.origCharHeight;
thg2.charWidth = thg2.origCharWidth;
thg2.charHeight = thg2.origCharHeight;
thg3.charWidth = thg3.origCharWidth;
thg3.charHeight = thg3.origCharHeight;
dialog.n= 17;
storyPage = 7;
}
else if(gill.HP ==0){
playTime = false;
thg1.charWidth = thg1.origCharWidth;
thg1.charHeight = thg1.origCharHeight;
thg2.charWidth = thg2.origCharWidth;
thg2.charHeight = thg2.origCharHeight;
thg3.charWidth = thg3.origCharWidth;
thg3.charHeight = thg3.origCharHeight;
dialog.n = 14;
storyPage = 6;
}
else if((thg1.HP > 0 || thg2.HP > 0 || thg3.HP > 0) && gill.HP > 0){
thg1.move();
if(thg1.HP < thg1.maxHP){
thg1.attack();
}
thg1.display();
noTint();
thg2.move();
if(thg2.HP < thg2.maxHP){
thg2.attack();
}
thg2.display();
noTint();
thg3.move();
if(thg3.HP < thg3.maxHP){
thg3.attack();
}
thg3.display();
noTint();
gill.move();
gill.display();
tony.move();
tony.display();
stan.move();
stan.display();
}
}
//game Page 4
if(gamePage == 4 && playTime == true){
if(thg.HP == 0){
playTime = false;
thg.charWidth = thg.origCharWidth;
thg.charHeight = thg.origCharHeight;
dialog.n= 28;
storyPage = 11;
}
else if(kid.HP == 0){
playTime = false;
kid.charWidth = kid.origCharWidth;
kid.charHeight = kid.origCharHeight;
dialog.n= 24;
storyPage = 9;
}
else if(gill.HP == 0){
playTime = false;
dialog.n= 26;
storyPage = 12;
}
else if((thg.HP > 0 || kid.HP > 0) && gill.HP > 0){
thg.move();
if(thg.HP < thg.maxHP){
thg.attack();
}
thg.display();
noTint();
kid.move();
if(kid.HP < kid.maxHP){
kid.attack();
}
kid.display();
noTint();
gill.move();
gill.display();
tony.move();
tony.display();
stan.move();
stan.display();
}
}
//game page 5
if(gamePage == 5 && playTime == true){
fill(126, 67, 40);
noStroke();
rect(400, 345, 20, 20);
if (gill.x + gill.gill_sprite.width > 400 &&
gill.x < 420 &&
gill.y + gill.gill_sprite.height > 345 &&
gill.y < 365){
playTime = false;
dialog.n = 32;
storyPage = 13;
}
gill.move();
gill.display();
tony.move();
tony.display();
stan.move();
stan.display();
kid.targetX = gill.x;
kid.targetY = gill.y;
kid.move();
kid.display();
noTint();
}
//storyPage 1
if(gamePage == 0 && storyPage == 1 && playTime == false){
gill.x = 200;
gill.y = 200;
gill.display();
stan.x = 200;
stan.y = 250;
stan.display();
tony.x = 200;
tony.y = 150;
tony.display();
oct.x = 300;
oct.y=120;
oct.targetX = oct.x;
oct.targetY = oct.y;
oct.display();
}
if(storyPage == 1 && dialog.n == 4){
dialog.n = 35;
}
if(dialog.n == 36){
playTime = true;
gamePage = 1;
}
//storyPage 2
if(storyPage == 2 && playTime == false){
gill.display();
tony.display();
stan.display();
if(storyPage == 2 && dialog.n == 11){
playTime = true;
caughtMode = 0;
markTime = millis();
gamePage = 2;
}
}
//storyPage 3
if(storyPage == 3 && playTime == false){
oct.display();
gill.display();
tony.display();
stan.display();
}
if(storyPage == 3 && dialog.n == 6){
reset();
}
//story Page 4
if(storyPage == 4 && playTime == false){
tony.display();
stan.display();
}
if(storyPage == 4 && dialog.n == 12){
reset();
}
//story page 5
if(storyPage == 5 && playTime == false){
thg1.x = 130;
thg1.y = 290;
thg1.targetX = thg1.x;
thg1.targetY = thg1.y;
thg1.display();
thg2.x = 300;
thg2.y = 10;
thg2.targetX = thg2.x;
thg2.targetY = thg2.y;
thg2.display();
thg3.x = 500;
thg3.y = 200;
thg3.targetX = thg3.x;
thg3.targetY = thg3.y;
thg3.display();
gill.x = 20;
gill.y = 100;
gill.targetX = 21;
gill.targetY = 101;
gill.display();
tony.move();
tony.display();
stan.move();
stan.display();
}
if(storyPage == 5 && dialog.n == 14){
playTime = true;
gamePage = 3;
}
//story page 6
if(storyPage == 6 && playTime == false){
thg1.display();
thg2.display();
thg3.display();
gill.targetX = -100;
gill.targetY = 200;
gill.move();
gill.display();
tony.move();
tony.display();
stan.move();
stan.display();
}
if(storyPage == 6 && dialog.n == 17){
reset();
}
//story page 7
if(storyPage == 7 && playTime == false){
thg1.display();
thg2.display();
thg3.display();
gill.display();
tony.move();
tony.display();
stan.move();
stan.display();
}
if(storyPage == 7 && dialog.n == 19){
reset();
}
//story page 8
if(storyPage == 8 && playTime == false){
gill.x = 50;
gill.y = 200;
gill.display();
stan.x = gill.x;
stan.display();
tony.x = gill.x;
tony.display();
kid.x = 335;
kid.y = 260;
kid.targetX = 336;
kid.targetY = 260;
kid.display();
thg.x = 380;
thg.y = 121;
thg.targetX = 379;
thg.targetY = 121;
thg.display();
}
if(storyPage == 8 && dialog.n == 24){
playTime = true;
gamePage = 4;
}
//story page 9
if(storyPage == 9 && playTime == false){
gill.display();
tony.display();
stan.display();
thg.display();
}
if(storyPage == 9 && dialog.n == 25){
currentBG = bg4;
gill.HP = gill.maxHP;
thg1.HP = thg1.maxHP;
thg2.HP = thg2.maxHP;
thg3.HP = thg3.maxHP;
storyPage = 10;
}
//story page 10
if(storyPage == 10 && playTime == false){
thg1.x = 130;
thg1.y = 290;
thg1.targetX = thg1.x;
thg1.targetY = thg1.y;
thg1.display();
thg2.x = 300;
thg2.y = 10;
thg2.targetX = thg2.x;
thg2.targetY = thg2.y;
thg2.display();
thg3.x = 500;
thg3.y = 200;
thg3.targetX = thg3.x;
thg3.targetY = thg3.y;
thg3.display();
gill.x = 20;
gill.y = 100;
gill.targetX = 21;
gill.targetY = 101;
gill.display();
thg.x = 20;
thg.y = 200;
thg.targetX = 21;
thg.targetY = 200;
thg.display();
tony.move();
tony.display();
stan.move();
stan.display();
}
if(storyPage == 10 && dialog.n == 26){
playTime = true;
gamePage = 3;
}
//story page 11
if(storyPage == 11 && playTime == false){
gill.display();
tony.display();
stan.display();
kid.display();
}
if(storyPage == 11 && dialog.n == 32){
playTime = true;
gamePage = 5;
}
//story page 12
if(storyPage == 12 && playTime == false){
thg.targetX = 700;
thg.targetY = 100;
thg.move();
thg.display();
gill.display();
kid.display();
stan.display();
tony.display();
}
if(storyPage == 12 && dialog.n == 28){
reset();
}
//story page 13
if(storyPage == 13 && playTime == false){
gill.display();
stan.display();
tony.display();
kid.display();
}
if(storyPage == 13 && dialog.n == 35){
reset();
}
}
//resets the game
void reset(){
gill.maxHP = 150;
gill.HP = gill.maxHP;
gill.strength = 20;
oct.HP = oct.maxHP;
thg.HP = thg.maxHP;
thg1.HP = thg1.maxHP;
thg2.HP = thg2.maxHP;
thg3.HP = thg3.maxHP;
kid.HP = kid.maxHP;
gamePage = 0;
storyPage = 0;
dialog.n = 1;
currentBG = bg1;
}
//this method may need to be simplified
//so that mousePressed only moves Gill.
//maybe another button should be used to
//progress the dialog
void mousePressed(){
if(playTime == true){
//player starts game by selecting difficulty
if(storyPage == 0){
if(mouseY > 310 && mouseY < 350){
if(mouseX > 40 && mouseX < 130){
//determine stats for easy difficulty
oct.maxHP = 300;
oct.HP = oct.maxHP;
oct.easing = 0.0035;
oct.atkSpeed = 3000;
oct.strength = 50;
thg1.maxHP = 200;
thg1.HP = thg1.maxHP;
thg1.easing = 0.005;
thg1.atkSpeed = 2000;
thg1.strength = 25;
thg2.maxHP = 300;
thg2.HP = thg2.maxHP;
thg2.easing = 0.008;
thg2.atkSpeed = 1500;
thg2.strength = 50;
thg3.maxHP = 300;
thg3.HP = thg3.maxHP;
thg3.easing = 0.008;
thg3.atkSpeed = 1500;
thg3.strength = 50;
thg.maxHP = 200;
thg.HP = thg.maxHP;
thg.easing = 0.007;
thg.atkSpeed = 1250;
thg.strength = 30;
kid.maxHP = 100;
kid.HP = kid.maxHP;
kid.easing = 0.01;
kid.atkSpeed = 1000;
kid.strength = 5;
storyPage = 1;
playTime = false;
}
if(mouseX > 230 && mouseX < 370){
//determine stats for medium difficulty
oct.maxHP = 500;
oct.HP = oct.maxHP;
oct.easing = 0.005;
oct.atkSpeed = 2000;
oct.strength = 50;
thg1.maxHP = 300;
thg1.HP = thg1.maxHP;
thg1.easing = 0.0075;
thg1.atkSpeed = 1500;
thg1.strength = 50;
thg2.maxHP = 500;
thg2.HP = thg2.maxHP;
thg2.easing = 0.0075;
thg2.atkSpeed = 1500;
thg2.strength = 75;
thg3.maxHP = 500;
thg3.HP = thg2.maxHP;
thg3.easing = 0.0075;
thg3.atkSpeed = 1500;
thg3.strength = 75;
thg.maxHP = 300;
thg.HP = thg.maxHP;
thg.easing = 0.01;
thg.atkSpeed = 1000;
thg.strength = 50;
kid.maxHP = 100;
kid.HP = kid.maxHP;
kid.easing = 0.01;
kid.atkSpeed = 1000;
kid.strength = 10;
storyPage = 1;
playTime = false;
}
if(mouseX > 470 && mouseX < 555){
//determine stats for hard difficulty
oct.maxHP = 600;
oct.HP = oct.maxHP;
oct.easing = 0.005;
oct.atkSpeed = 1500;
oct.strength = 75;
thg1.maxHP = 300;
thg1.HP = thg1.maxHP;
thg1.easing = 0.001;
thg1.atkSpeed = 1000;
thg1.strength = 50;
thg2.maxHP = 600;
thg2.HP = thg2.maxHP;
thg2.easing = 0.001;
thg2.atkSpeed = 1000;
thg2.strength = 75;
thg3.maxHP = 600;
thg3.HP = thg2.maxHP;
thg3.easing = 0.001;
thg3.atkSpeed = 1000;
thg3.strength = 75;
thg.maxHP = 400;
thg.HP = thg.maxHP;
thg.easing = 0.01;
thg.atkSpeed = 1000;
thg.strength = 50;
kid.maxHP = 100;
kid.HP = kid.maxHP;
kid.easing = 0.01;
kid.atkSpeed = 1000;
kid.strength = 20;
storyPage = 1;
playTime = false;
}
}
}
}
//if playTime is false, player
//clicks to progress the dialog
else if(playTime == false){
dialog.update();
}
}
void mouseMoved(){
if(playTime == true){
gill.targetX = mouseX;
gill.targetY = mouseY;
}
}
void keyPressed(){
/*if player presses the space bar while overlapping a
fightable NPC, that NPC takes damage.
uses keypressed instead of mousepressed
because clicking the mouse while in a fight
often causes the player to click outside the game*/
if(playTime == true){
if(key == 32){
if(oct.overlap == true){
oct.HP -= gill.strength;
}
if(thg1.overlap == true){
thg1.HP -= gill.strength;
}
if(thg2.overlap == true){
thg2.HP -= gill.strength;
}
if(thg3.overlap == true){
thg3.HP -= gill.strength;
}
if(thg.overlap == true){
thg.HP -= gill.strength;
}
if(kid.overlap == true){
kid.HP -= gill.strength;
}
}
}
//checks coded keys for caught! minigame
if(key == CODED){
if(keyCode == UP){
if(caughtMode == 3){
caughtMode = 4;
}
else{
caughtMode = 0;
}
}
if(keyCode == DOWN){
if(caughtMode == 1){
caughtMode = 2;
}
else{
caughtMode = 0;
}
}
if(keyCode == LEFT){
if(caughtMode == 4){
caughtMode = 5;
}
else{
caughtMode = 0;
}
}
if(keyCode == RIGHT){
if(caughtMode == 0){
caughtMode = 1;
}
else if(caughtMode == 2){
caughtMode = 3;
}
else{
caughtMode = 0;
}
}
}
}
//Non-player character class
//used to create different non player
//objects in setup
class NPC{
int maxHP;
int HP;
float easing;
PImage character;
PImage character_left;
PImage character_right;
int strength;
float x;
float y;
float targetX;
float targetY;
float origCharWidth;
float origCharHeight;
float charWidth;
float charHeight;
boolean overlap;
float markTime;
int atkSpeed;
boolean initiateTimer = false;
Gill g;
NPC(int hitPoints, float speed, PImage sprite_left, PImage sprite_right,
float spriteWidth, float spriteHeight, int power, int attackSP, Gill gIn){
maxHP = hitPoints;
HP = maxHP;
easing = speed;
character_left = sprite_left;
character_right = sprite_right;
character = character_left;
origCharWidth = spriteWidth;
origCharHeight = spriteHeight;
strength = power;
atkSpeed = attackSP;
g = gIn;
charWidth = origCharWidth;
charHeight = origCharHeight;
}
void move(){
if(HP < maxHP){
targetX = g.x-(character.width/2);
targetY = g.y-(character.height/2);
}
float dx = targetX - x;
float dy = targetY - y;
//assures efficiency by stopping the square
//when it reaches its destination
if(abs(dx) > 1.0){
x += (targetX - x) * easing;
}
if(abs(dy) > 1.0){
y += (targetY - y) * easing;
}
//use an if statement to check if targetX is less than x
//if it is, width and height are negative
if(targetX > x){
character = character_right;
}
else{
character = character_left;
}
overlap();
}
//this method checks if the NPC is overlapping
//with gill, who is passed in through the constructor
void overlap(){
if (g.x + g.gill_sprite.width/2> x &&
g.x - g.gill_sprite.width/2< x + charWidth &&
g.y + g.gill_sprite.height/2> y &&
g.y - g.gill_sprite.height/2< y + charHeight){
overlap = true;
}
else{
overlap = false;
}
}
//if character is overlapping gill for n seconds
//character attacks and gill takes damage
//character's sprite grows before it attacks and
//returns to normal when it attacks as an attack animation
void attack(){
if(overlap == true && initiateTimer == false){
markTime = millis();
initiateTimer = true;
}
float m = millis();
if(m > markTime + atkSpeed && initiateTimer == true){
//gill takes damage equivelant to NPC's strength
//NPC's width and height return to normal
gill.HP -= strength;
charWidth = origCharWidth;
charHeight = origCharHeight;
markTime = millis();
initiateTimer = false;
}
else if(overlap == true && initiateTimer == true){
//use millis to count to n, then deal damage
if(m < markTime + atkSpeed){
if(m > markTime + atkSpeed*0.5){
tint(200, 0, 0);
}
}
}
else if(overlap == false){
m = 0;
initiateTimer = false;
noTint();
}
println();
}
void display(){
//use an if statement to check if targetX is less than x
//determines the direction the character is facing
if(targetX > x){
character = character_right;
}
else{
character = character_left;
}
image(character, x, y, charWidth, charHeight);
//if the NPC has taken damage, their HP meter
//is displayed in the upper right corner
if(HP < maxHP){
HP = constrain(HP, 0, maxHP);
strokeCap(ROUND);
strokeWeight(20);
stroke(150, 30, 30, 175);
line(470, 20, 570, 20);
strokeWeight(10);
stroke(100);
line(470, 20, 570, 20);
if(HP > (maxHP*0.6)){
stroke(20, 230, 20, 200);
}
else if(HP > maxHP*0.2){
stroke(255, 190, 0);
}
else{
stroke(200, 30, 30, 200);
}
if(HP > 0){
//line(470, 20, 470+(HP/maxHP)*100, 20);
float hpCounter = map(HP, maxHP, 0, 100, 0);
line(470, 20, 470+hpCounter, 20);
}
}
}
}
//only one gill object will be created,
//but using this class helps organization and
//easier manipulation of the Gill object's parameters
class Gill{
float x;
float y;
float targetX;
float targetY;
PImage gLeft;
PImage gRight;
PImage gill_sprite;
float easing = 0.05;
int HP;
int maxHP;
int strength;
Gill(int maxHitPoints, PImage gillLeft, PImage gillRight,
float speed, int power){
maxHP = maxHitPoints;
HP = maxHP;
gLeft = gillLeft;
gRight = gillRight;
easing = speed;
strength = power;
gill_sprite = gRight;
x = 200;
y = 200;
targetX = x+1;
targetY = y;
}
//moves gill to targetX, targetY and calculates easing
void move(){
float dx = targetX - x;
float dy = targetY - y;
//assures efficiency by stopping the square
//when it reaches its destination
if(abs(dx) > 1.0){
x += (targetX - x) * easing;
}
if(abs(dy) > 1.0){
y += (targetY - y) * easing;
}
//use an if statement to check if targetX is less than x
//if it is, width and height are negative
if(targetX > x){
gill_sprite = gRight;
}
else{
gill_sprite = gLeft;
}
}
void display(){
//displays gill
image(gill_sprite, x-(gill_sprite.width/2), y-(gill_sprite.height/2));
//displays gill's HP meter and constrains HP value
HP = constrain(HP, 0, maxHP);
strokeCap(ROUND);
strokeWeight(20);
stroke(30, 30, 150, 150);
line(20, 20, 120, 20);
strokeWeight(10);
stroke(100, 200);
line(20, 20, 120, 20);
if(HP > (maxHP*0.6)){
stroke(20, 230, 20, 200);
}
else if(HP > maxHP*0.2){
stroke(255, 190, 0);
}
else{
stroke(200, 30, 30, 200);
}
if(HP > 0){
//line(20, 20, 20+(HP/maxHP)*100, 20);
float hpCounter = map(HP, maxHP, 0, 100, 0);
line(20, 20, 20+hpCounter, 20);
}
}
}
class Dialog{
String[] words;
int n;
PFont font;
Dialog(){
font = loadFont("ArialHebrew-Bold-12.vlw");
n = 0;
//fill this array with all the dialog for the game
words = new String[37];
words[0] = "";
words[1] = "Gill is a little sea creature in a big ocean. Life has become mundane and boring and Gill wants to get out, go on adventures, and be come famous throughout the sea. Two strange little critters, Stan and Tony, accompany him on his journey. \n\n-click to continue-";
words[2] = "Tony: Wow look at the size of him! Imagine the bragging rights if you beat him up!";
words[3] = "Stan: No no no…there are plenty of other ways to get noticed in the ocean without the use of random violence… Let's just keep swimming.";
words[4] = "Tony: Aaahaha! You got clobbered! I knew you'd never get anywhere!";
words[5] = "Stan: ...";
words[6] = "Tony: Aaahaha! Good job, kid! You're tougher than ya' look!";
words[7] = "Stan: I really wish you would listen to me... I don't think that was a very good idea";
words[8] = "...";
words[9] = "Stan: What the...Oh no! there was a fishing hook stuck in that octopus! Quickly, get away!";
words[10] = "Press the arrow keys in the correct order to escape! Quickly, your life depends on it!";
words[11] = "The fishing-line is reeled in and takes you away. Your journey is over, it had barely just begun.";
words[12] = "Stan: ...Where are we?";
words[13] = "Tony: Ah! This must be 'The Reef!' I've heard of this place. A lot of tough thugs hang around here. Show 'em what you're made of, kid!";
words[14] = "Tony: Aaahaha! Can't handle the big league, huh kid? What a weakling!";
words[15] = "Stan: I always told you fighting was a bad idea...";
words[16] = "You lose the fight and flee from 'The Reef.' Ashamed by your failure, you end your journey.";
words[17] = "Thug fish: Ok! Ok! I get it! Just leave me alone!";
words[18] = "Epilogue: All the fish recognized your strength. You joined the gang, eventually leading them and becoming known as one of the strongest fish in the sea.";
words[19] = "Little fish: Help me! Help me! Somebody help!";
words[20] = "Stan: What on Earth?! What is going on here?!";
words[21] = "Thug fish: This kid's got a treasure map! Gimme a hand here and I'll split the spoils with ya!";
words[22] = "Tony: Did you hear that? We gotta get our hands on that map!";
words[23] = "Stan: Are you joking?! We need to help that child!";
words[24] = "Thug fish: Hey, that was pretty good! And we got the map! Let's go back to my base and look this thing over. I'm sure we can make a fortune off this!";
words[25] = "Thug fish: Here's our little hang out. Why don't you go introduce yourself to my buddies? They're friendly enough...haha";
words[26] = "Thug fish: Got it! Haha, later suckers!";
words[27] = "Maybe this just isn't for you. Your journey is has ended.";
words[28] = "Thug fish: Tch! Getting in my way... I'll be back!";
words[29] = "Little fish: Thank you for saving me! We need to get out of her before they come back!";
words[30] = "...";
words[31] = "Little fish: Oh no! Part of the map was torn off! Quickly, we need to find it before they get here!";
words[32] = "Stan: Ah, here it is!";
words[33] = "Little fish: Great! now let's follow it to the treasure!";
words[34] = "The four of you followed the map to the treasure, a venture that was the first of many. The four of you teamed up and continued to hunt for more treasure successfully, eventually becoming the most renowned treasure hunters in the sea.";
words[35] = "Attack the squid or keep swimming. Move the mouse to move Gill. To keep swimming, move to the far right of the screen. To attack, press the space bar while over an enemy. Enemies will turn red when they are about to attack, use this signal as an opportunity to move out of the way! \nTIP: Don't stop moving in a difficult fight!";
words[36] = "";
}
void display(){
stroke(50);
strokeWeight(5);
strokeJoin(ROUND);
fill(255, 200);
rect(10, 300, 580, 90);
fill(50);
textFont(font);
textSize(12);
text(words[n], 15, 305, 570, 80);
}
//checks the storyPage and sets currentString
//to appropriate string from the array
void update(){
n++;
}
}Gregory - Project 1
on Wednesday, Oct 29, 2008 – 2:41 am
One Comment
wow. very elaborate. it’s complex yet simple enough. alot of stages/mini games.
perhaps not so much narration. a little less would help to move the game along. Or, lump them all into one box.
other wise, great graphics, great concept. love the “Street Fighting” green bars.
Lena