Press left and right arrow keys to select an option, then hit enter multiple times! Once you reach battle mode, press arrow keys to move the heart around to dodge the bones. If your HP reaches 0, you lose! (Click the rectangle on Sans for a special boss battle)
xxxxxxxxxx
//For my final project, I learned how to use arrays to make my random falling bones
//array tutorial: https://www.youtube.com/watch?v=VIQoUghHSxU
//image setup
PImage FIGHT; //fight button
PImage ACT; //act button
PImage ITEM; //item button
PImage MERCY; //mercy button
PImage sans; //sans
PImage soul; //soul
PImage chara; //player name
PImage level; //player level
PImage badTime; //text talking about a bad time
PImage HP; //hp bar
PImage HP_level; //hp number
PImage target; //fight button target
PImage spare; //spare selection
PImage sansText; //text saying "sans"
PImage check; //text saying "check"
PImage sansStats; //text showing sans' stats
PImage noItems; //text saying "no items lol"
PImage miss; //text saying "miss"
PImage bone; //bones you have to dodge
PImage gameOver; //game over text
PImage youWin; //you win text
PImage chatBox;
PImage slash;
//integer setup
int rectWidth = 550; //allows rectangle to get wider/thinner depending on which mode the game is in
int rectHeight = 150; //allows rectangle to get taller/shorter depending on which mode the game is in
int rectY = 290; //allows rectangle to move up/down depending on which mode the game is in
int highlight = 0; //integer for which button is highlighted
int soulX = 312; //allows player to move soul left and right
int soulY = 332; //allows player to move soul up and down
int sansX = 240; //allows sans to move left/right depending on which mode the game is in
int sansY = 20; //allows sans to move up/down depending on which mode the game is in
int boneY = 180; //allows bones to fall during battle mode
int hitY = boneY + 35; //bone hit box (y axis)
int soulHitX = soulX + 10; //soul hit box (x axis)
int soulHitY = soulY + 10; //soul hit box (y axis)
int health = 92; //player health
int attackX = 50;
int attackCount = 0;
int fallCount = 0;
int fightCount = 0; //how many times did the player hit enter on the fight button?
int actCount = 0; //how many times did the player hit enter on the act button?
int itemCount = 0; //how many times did the player hit enter on the item button?
int mercyCount = 0; //how many times did the player hit enter on the mercy button?
//array setup (for falling bones)
int boneX = [random(229,273), random(285,329), random(341,385)]; //three bones placed randomly along x axis (also made sure bones don't overlap)
int hitX = [boneX[0] + 20, boneX[1] + 20, boneX[2] + 20]; //bone hit box (x axis)
//boolean setup
boolean battle = false; //is the game in battle mode?
boolean selection = true; //is the game in selection mode?
boolean gasterMode = false; //is the player battling gaster?
boolean gasterSel = false; //is the game in selection mode while battling gaster?
boolean gasterBat = false; //is the game in battle mode while battling gaster?
boolean lose = false; //did the player lose the game
boolean win = false; //did the player win the game
void setup() {
rectMode(CENTER);
size(640,480);
FIGHT = loadImage("FIGHT.png"); //fight button
ACT = loadImage("ACT.png"); //act button
ITEM = loadImage("ITEM.png"); //item button
MERCY = loadImage("MERCY.png"); //mercy button
sans = loadImage("sans.png"); //sans
HP = loadImage("HP.png"); //hp bar
HP_level = loadImage("HP level.png"); //hp level
chara = loadImage("chara.png"); //player name
level = loadImage("level.png"); //player level
badTime = loadImage("bad time.png"); //text talking about a bad time
soul = loadImage("soul.png"); //the soul (heart)
sansText = loadImage("sans text.png"); //text saying "sans"
target = loadImage("target.png"); //target to attack sans
miss = loadImage("miss.png"); //text saying "miss"
bone = loadImage("bone.png"); //falling bones
gameOver = loadImage("game over.png"); //text saying "game over"
youWin = loadImage("you win.png"); //text saying "you win"
check = loadImage("check.png"); //text saying "check"
sansStats = loadImage("sans stats.png"); //sans' stats
noItems = loadImage("no items.png"); //text saying "no items lol"
spare = loadImage("spare.png");
chatBox = loadImage("chat box.png");
slash = loadImage("slash.png");
}
void draw() {
background(0);
if (lose == false && win == false) { //if the player did not lose the game
image(FIGHT,50,420);
image(ACT,195,420);
image(ITEM,340,420);
image(MERCY,485,420);
image(HP,220,385);
image(HP_level,500,385);
image(chara,30,380);
image(level,120,380);
image(sans,sansX,sansY);
noFill();
stroke(255);
strokeWeight(8);
rect(320,rectY,rectWidth,rectHeight); //fight box + text box
fill(255);
textSize(20);
text(health,335,408); //text showing player's health
}
if (battle == true || gasterBat == true) { //if in battle
if (health <= 0) { //if the health reaches 0
selection = false; //turn off selection mode
battle = false; //turn off battle mode
gasterSel = false; //turn off gaster selection mode
gasterBat = false; //turn off gaster battle mode
lose = true; //turn on the "game over" screen
} else if (attackCount == 5) {
selection = false;
battle = false;
gasterSel = false;
gasterBat = false;
win = true;
} else if (fallCount == 5) {
if (gasterMode == false) {
battle = false; //switches out of battle mode
selection = true; //switches to selection mode
} else if (gasterMode == true) {
gasterBat = false; //switches out of battle mode
gasterSel = true; //switches to selection mode
}
}
}
if (lose == true) {
image(gameOver,90,10);
fill(255);
textSize(30);
text("PRESS ENTER",225,300);
} else if (win == true) {
image(youWin,90,10);
fill(255);
textSize(30);
text("PRESS ENTER",225,300);
}
if (gasterSel == true) {
image(badTime,50,195);
sans = loadImage("gaster.png");
badTime = loadImage("gaster bad time.png");
sansText = loadImage("gaster text.png");
check = loadImage("gaster check.png");
noItems = loadImage("gaster no items.png");
spare = loadImage("gaster spare.png");
sansStats = loadImage("gaster stats.png");
soul = loadImage("gaster soul.png");
spare = loadImage("gaster spare.png");
rectWidth = 550;
rectHeight = 150;
rectY = 290;
soulX = 312;
soulY = 332;
sansX = 265;
sansY = 20;
boneY = 180;
hitY = boneY + 35;
fallCount = 0;
if (highlight == 1) { //fight button selected
FIGHT = loadImage("gaster fight.png");
ACT = loadImage("ACT.png");
ITEM = loadImage("ITEM.png");
MERCY = loadImage("MERCY.png");
} else if (highlight == 2) { //act button selected
FIGHT = loadImage("FIGHT.png");
ACT = loadImage("gaster act.png");
ITEM = loadImage("ITEM.png");
MERCY = loadImage("MERCY.png");
} else if (highlight == 3) { //act button selected
FIGHT = loadImage("FIGHT.png");
ACT = loadImage("ACT.png");
ITEM = loadImage("gaster item.png");
MERCY = loadImage("MERCY.png");
} else if (highlight == 4) { //act button selected
FIGHT = loadImage("FIGHT.png");
ACT = loadImage("ACT.png");
ITEM = loadImage("ITEM.png");
MERCY = loadImage("gaster mercy.png");
} else {
FIGHT = loadImage("FIGHT.png");
ACT = loadImage("ACT.png");
ITEM = loadImage("ITEM.png");
MERCY = loadImage("MERCY.png");
}
}
if (selection == true) {
image(badTime,50,195);
rectWidth = 550;
rectHeight = 150;
rectY = 290;
soulX = 312;
soulY = 332;
sansX = 240;
sansY = 20;
boneY = 180;
hitY = boneY + 35;
fallCount = 0;
if (highlight == 1) { //fight button selected
FIGHT = loadImage("FIGHT 2.png");
ACT = loadImage("ACT.png");
ITEM = loadImage("ITEM.png");
MERCY = loadImage("MERCY.png");
} else if (highlight == 2) { //act button selected
FIGHT = loadImage("FIGHT.png");
ACT = loadImage("ACT 2.png");
ITEM = loadImage("ITEM.png");
MERCY = loadImage("MERCY.png");
} else if (highlight == 3) { //act button selected
FIGHT = loadImage("FIGHT.png");
ACT = loadImage("ACT.png");
ITEM = loadImage("ITEM 2.png");
MERCY = loadImage("MERCY.png");
} else if (highlight == 4) { //act button selected
FIGHT = loadImage("FIGHT.png");
ACT = loadImage("ACT.png");
ITEM = loadImage("ITEM.png");
MERCY = loadImage("MERCY 2.png");
} else {
FIGHT = loadImage("FIGHT.png");
ACT = loadImage("ACT.png");
ITEM = loadImage("ITEM.png");
MERCY = loadImage("MERCY.png");
}
}
if (battle == true) {
sansY = 0;
sansX = 240;
rectY = 270;
attackX = 50;
rectHeight = 200; //grow height during battle mode
rectWidth = 200; //shrink width during battle mode
fill(0);
noStroke();
rect(hitX[0],hitY,25,60); //hit box 1
rect(hitX[1],hitY,25,60); //hit box 2
rect(hitX[2],hitY,25,60); //hit box 3
rect(soulHitX,soulHitY,20,20); //soul hit box
image(soul,soulX,soulY); //soul
image(bone,boneX[0],boneY); //bone 1
image(bone,boneX[1],boneY); //bone 2
image(bone,boneX[2],boneY); //bone 3
boneY = boneY + 0.5; //move bone down
hitY = hitY + 0.5; //move hit box down
soulHitX = soulX + 10; //make soul hit box follow soul
soulHitY = soulY + 10; //make soul hit box follow soul
if (health >= 0) { //when the soul hit box touches the bone hit boxes, the player's health goes down
if (soulHitX - 10 <= hitX[0] + 13 && soulHitX - 10 >= hitX[0] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX + 10 <= hitX[0] + 13 && soulHitX + 10 >= hitX[0] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX - 10 <= hitX[0] + 13 && soulHitX - 10 >= hitX[0] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30 || soulHitX + 10 <= hitX[0] + 13 && soulHitX + 10 >= hitX[0] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30) {
health = health - 0.4;
}
if (soulHitX - 10 <= hitX[1] + 13 && soulHitX - 10 >= hitX[1] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX + 10 <= hitX[1] + 13 && soulHitX + 10 >= hitX[1] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX - 10 <= hitX[1] + 13 && soulHitX - 10 >= hitX[1] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30 || soulHitX + 10 <= hitX[1] + 13 && soulHitX + 10 >= hitX[1] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30) {
health = health - 0.4;
}
if (soulHitX - 10 <= hitX[2] + 13 && soulHitX - 10 >= hitX[2] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX + 10 <= hitX[2] + 13 && soulHitX + 10 >= hitX[2] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX - 10 <= hitX[2] + 13 && soulHitX - 10 >= hitX[2] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30 || soulHitX + 10 <= hitX[2] + 13 && soulHitX + 10 >= hitX[2] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30) {
health = health - 0.4;
}
}
if (boneY >= 300) { //once the bones reach the bottom of the battle square
boneY = 180; //bring bones back to top
hitY = boneY + 35; //bring bone hit boxes back to top
fallCount = fallCount + 1;
boneX[0] = random(229,273); //randomize x axis of bone 1
boneX[1] = random(285,329); //randomize x axis of bone 2
boneX[2] = random(341,385); //randomize x axis of bone 3
hitX[0] = boneX[0] + 20; //randomize x axis of hit box 1
hitX[1] = boneX[1] + 20; //randomize x axis of hit box 2
hitX[2] = boneX[2] + 20; //randomize x axis of hit box 3
}
} else if (gasterBat == true) {
sansY = 0;
sansX = 265;
rectY = 270;
attackX = 50;
rectHeight = 200; //grow height during battle mode
rectWidth = 200; //shrink rect during battle mode
fill(0);
noStroke();
rect(hitX[0],hitY,25,60); //hit box 1
rect(hitX[1],hitY,25,60); //hit box 2
rect(hitX[2],hitY,25,60); //hit box 3
rect(soulHitX,soulHitY,20,20); //soul hit box
image(soul,soulX,soulY); //soul
image(bone,boneX[0],boneY); //bone 1
image(bone,boneX[1],boneY); //bone 2
image(bone,boneX[2],boneY); //bone 3
boneY = boneY + 1; //move bone down
hitY = hitY + 1; //move hit box down
soulHitX = soulX + 10; //make hit box follow soul
soulHitY = soulY + 10; //make hit box follow soul
if (health >= 0) { //when the soul hit box touches the bone hit boxes, the player's health goes down
if (soulHitX - 10 <= hitX[0] + 13 && soulHitX - 10 >= hitX[0] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX + 10 <= hitX[0] + 13 && soulHitX + 10 >= hitX[0] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX - 10 <= hitX[0] + 13 && soulHitX - 10 >= hitX[0] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30 || soulHitX + 10 <= hitX[0] + 13 && soulHitX + 10 >= hitX[0] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30) {
health = health - 1;
}
if (soulHitX - 10 <= hitX[1] + 13 && soulHitX - 10 >= hitX[1] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX + 10 <= hitX[1] + 13 && soulHitX + 10 >= hitX[1] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX - 10 <= hitX[1] + 13 && soulHitX - 10 >= hitX[1] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30 || soulHitX + 10 <= hitX[1] + 13 && soulHitX + 10 >= hitX[1] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30) {
health = health - 1;
}
if (soulHitX - 10 <= hitX[2] + 13 && soulHitX - 10 >= hitX[2] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX + 10 <= hitX[2] + 13 && soulHitX + 10 >= hitX[2] - 13 && soulHitY - 10 <= hitY + 30 && soulHitY - 10 >= hitY - 30 || soulHitX - 10 <= hitX[2] + 13 && soulHitX - 10 >= hitX[2] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30 || soulHitX + 10 <= hitX[2] + 13 && soulHitX + 10 >= hitX[2] - 13 && soulHitY + 10 <= hitY + 30 && soulHitY + 10 >= hitY - 30) {
health = health - 1;
}
}
if (boneY >= 300) { //once the bones reach the bottom of the battle square
boneY = 180; //bring bones back to top
hitY = boneY + 35; //bring hit boxes back to top
fallCount = fallCount + 1;
boneX[0] = random(229,273); //randomize x axis of bone 1
boneX[1] = random(285,329); //randomize x axis of bone 2
boneX[2] = random(341,385); //randomize x axis of bone 3
hitX[0] = boneX[0] + 20; //randomize x axis of hit box 1
hitX[1] = boneX[1] + 20; //randomize x axis of hit box 2
hitX[2] = boneX[2] + 20; //randomize x axis of hit box 3
}
}
if (fightCount == 1) { //if the player presses enter on the fight button once
image(sansText,69,242); //display text saying "sans"
} else if (fightCount == 2) { //if the player presses enter on the fight button twice
image(target,48,233); //display target
fill(255);
noStroke();
rect(attackX,290,5,145);
if (attackX <= 585) {
attackX = attackX + 4;
} else if (attackX >= 585) {
fightCount = 3;
}
} else if (fightCount == 3) { //if the player presses enter on the fight button three times
image(target,48,233); //display target
image(miss,300,20); //display text saying "miss"
noStroke();
rect(attackX,290,5,145);
sansX = 170; //move sans to the left
} else if (fightCount == 4) { //if the player presses enter on the fight button four times
if (attackCount < 5) {
fightCount = 0; //reset the fight count
if (gasterMode == false) { //if the player isn't fighting gaster
battle = true; //turn on battle mode
} else if (gasterMode == true) { //if the player is fighting gaster
gasterBat = true; //turn on gaster battle mode
}
} else if (attackCount == 5) {
sans = loadImage("sans shocked.png");
image(slash,170,20);
}
} else if (attackCount == 5) {
if (fightCount == 5) {
sans = loadImage("sans hurt.png");
} else if (fightCount == 6) {
sans = loadImage("sans hurt 2.png");
image(chatBox,320,50);
fill(0);
textSize(15);
text(". . .",365,80);
} else if (fightCount == 7) {
sans = loadImage("sans hurt 3.png");
image(chatBox,320,50);
fill(0);
textSize(15);
text(". . .",365,80);
} else if (fightCount == 8) {
sans = loadImage("sans hurt 4.png");
image(chatBox,320,50);
fill(0);
textSize(15);
text(". . .",365,80);
} else if (fightCount == 9) {
sans = loadImage("sans hurt 3.png");
image(chatBox,320,50);
fill(0);
textSize(15);
text("s o . . .",365,80);
} else if (fightCount == 10) {
sans = loadImage("sans hurt 3.png");
image(chatBox,320,50);
fill(0);
textSize(15);
text("g u e s s t h a t ' s i t ,",365,80);
text("h u h ?", 365, 105);
} else if (fightCount == 11) {
sans = loadImage("sans hurt 4.png");
image(chatBox,320,50);
fill(0);
textSize(15);
text(". . .",365,80);
} else if (fightCount == 12) {
sans = loadImage("sans hurt 2.png");
image(chatBox,320,50);
fill(0);
textSize(15);
text("j u s t . . .",365,80);
} else if (fightCount == 13) {
sans = loadImage("sans hurt 2.png");
image(chatBox,320,50);
fill(0);
textSize(15);
text("d o n ' t s a y i",365,80);
text("d i d n ' t w a r n y o u .", 365, 105);
} else if (fightCount == 14) {
sans = loadImage("sans hurt 2.png");
} else if (fightCount == 15) {
sans = loadImage("sans hurt 6.png");
} else if (fightCount == 16) {
sans = loadImage("sans hurt 6.png");
image(chatBox,320,50);
fill(0);
textSize(15);
text("w e l p .",365,80);
} else if (fightCount == 17) {
sans = loadImage("sans hurt 5.png");
image(chatBox,320,50);
fill(0);
textSize(15);
text("i ' m g o i n g t o",365,80);
text("g r i l l b y ' s .", 365, 105);
} else if (fightCount == 18) {
sans = loadImage("sans hurt 6.png");
if (sansX >= -160) {
sansX = sansX - 0.5;
} else if (sansX <= -160) {
selection = false;
battle = false;
gasterSel = false;
gasterBat = false;
win = true;
}
}
} else if (fightCount == 5) {
if (gasterMode == false) { //if the player isn't fighting gaster
battle = true; //turn on battle mode
} else if (gasterMode == true) { //if the player is fighting gaster
gasterBat = true; //turn on gaster battle mode
}
} else if (actCount == 1) { //if the player presses enter on the act button once
image(sansText,69,242); //display text saying "sans"
} else if (actCount == 2) { //if the player presses enter on the act button twice
image(check,69,242); //display text saying "check"
} else if (actCount == 3) { //if the player presses enter on the act button three times
image(sansStats,50,195); //display sans' stats
} else if (actCount == 4) { //if the player presses enter on the act button four times
actCount = 0; //reset the act count
if (gasterMode == false) { //if the player isn't fighting gaster
battle = true; //turn on battle mode
} else if (gasterMode == true) { //if the player is fighting gaster
gasterBat = true; //turn on gaster battle mode
}
} else if (itemCount == 1) { //if the player presses enter on the item button once
image(noItems,50,195); //display text saying "no items lol"
} else if (itemCount == 2) { //if the player presses enter on the item button twice
itemCount = 0; //reset item count
if (gasterMode == false) { //if the player isn't fighting gaster
battle = true; //turn on battle mode
} else if (gasterMode == true) { //if the player is fighting gaster
gasterBat = true; //turn on gaster battle mode
}
} else if (mercyCount == 1) { //if the player presses enter on the mercy button once
image(spare,69,242); //display text saying "spare"
} else if (mercyCount == 2) { //if the player presses enter on the mercy button twice
mercyCount = 0; //reset mercy count
if (gasterMode == false) { //if the player is fighting gaster
battle = true; //turn on battle mode
} else if (gasterMode == true) { //if the player isn't fighting gaster
gasterBat = true; //turn on gaster battle mode
}
}
}
void keyReleased() {
if (lose == true || win == true) { //if the player is seeing the "game over" screen
if (key == ENTER) { //if they hit enter
sans = loadImage("sans.png");
badTime = loadImage("bad time.png");
sansText = loadImage("sans text.png");
check = loadImage("check.png");
noItems = loadImage("no items.png");
spare = loadImage("spare.png");
sansStats = loadImage("sans stats.png");
soul = loadImage("soul.png");
highlight = 0; //reset highlight value
fightCount = 0;
attackCount = 0;
health = 92; //reset health
selection = true; //turn on selection mode
lose = false; //turn off "game over" screen
win = false; //turn off "you win" screen
battle = false; //turn off battle mode
gasterBat = false; //turn off gaster battle mode
gasterSel = false; //turn off gaster selection mode
gasterMode = false; //no longer battling gaster
}
}
if (battle == false && gasterBat == false) { //if it is not in any battle mode
if (key == ENTER) { //if they hit enter
if (highlight == 1) { //fight button
if (fightCount < 18) {
fightCount = fightCount + 1;
}
selection = false; //switches out of selection mode
gasterSel = false; //switches out of gaster selection mode
if (fightCount == 3) {
attackCount = attackCount + 1
}
} else if (highlight == 2) { //act button selected
actCount = actCount + 1;
selection = false; //switches out of selection mode
gasterSel = false; //switches out of gaster selection mode
} else if (highlight == 3) { //item button selected
itemCount = itemCount + 1;
selection = false; //switches out of selection mode
gasterSel = false; //switches out of gaster selection mode
} else if (highlight == 4) { //mercy button selected
mercyCount = mercyCount + 1;
selection = false; //switches out of selection mode
gasterSel = false; //switches out of gaster selection mode
}
}
}
if (selection == true || gasterSel == true) { //if it is in any selection mode
if (key == CODED) {
if (keyCode == RIGHT) { //if they hit the right arrow key
if (highlight <= 3) { //wont let highlight value go over 4
highlight = highlight + 1;
}
} else if (keyCode == LEFT) { //if they hit the left arrow key
if (highlight >= 2) { //wont let highlight value go under 1
highlight = highlight - 1;
}
}
}
}
}
void keyPressed() {
if (battle == true) {
if (key == CODED) {
if (soulX <= 395) { //wont let soulX value go over 396 (stay in box)
if (keyCode == RIGHT) {
soulX = soulX + 1; //move to the right
}
}
if (soulX >= 225) { //wont let soulX value go under 224 (stay in box)
if (keyCode == LEFT) {
soulX = soulX - 1; //move to the left
}
}
if (soulY >= 175) { //wont let soulY value go under 174 (stay in box)
if (keyCode == UP) {
soulY = soulY - 1; //move up
}
}
if (soulY <= 345) { //wont let soulY value go over 346 (stay in box)
if (keyCode == DOWN) {
soulY = soulY + 1; //move down
}
}
}
} else if (gasterBat == true) {
if (key == CODED) {
if (keyCode == SHIFT) {
if (gasterMode == false) {
battle = false; //switches out of battle mode
selection = true; //switches to selection mode
} else if (gasterMode == true) {
gasterBat = false; //switches out of battle mode
gasterSel = true; //switches to selection mode
}
}
if (soulX <= 395) { //wont let soulX value go over 396 (stay in box)
if (keyCode == RIGHT) {
soulX = soulX + 1; //move to the right
}
}
if (soulX >= 225) { //wont let soulX value go under 224 (stay in box)
if (keyCode == LEFT) {
soulX = soulX - 1; //move to the left
}
}
if (soulY >= 175) { //wont let soulY value go under 174 (stay in box)
if (keyCode == UP) {
soulY = soulY - 1; //move up
}
}
if (soulY <= 345) { //wont let soulY value go over 346 (stay in box)
if (keyCode == DOWN) {
soulY = soulY + 1; //move down
}
}
}
}
}
void mouseClicked() {
if (selection == true) { //if in selection mode
if (mouseX >= 316 && mouseX <= 328 && mouseY >= 94 && mouseY <= 114) { //if they click on the rectangle on sans
selection = false; //turn off selection mode
lose = false; //turn off game over screen
battle = false; //turn off battle mode
gasterSel = true; //turn on gaster selection mode
gasterMode = true; //player is now battling gaster
sansX = 275;
attackCount = 0;
}
}
}