/* A game */ /* Cadin Batrack 9.30.05 */ int totalPodBays = 6; int p1Pod, p2Pod; boolean chooseMovesisActive; boolean battleReady, battleActive; PImage bg; PImage p1info, p2info; PImage p1chooseMove, p1chooseMove_a, p2chooseMove, p2chooseMove_a; PImage notReady, ready; PImage dialogBox; int p1power, p2power; int p1ChooseCounter, p2ChooseCounter; //PFont hobo12 = loadFont("hobo-12.vlw"); PFont hobo12; int currentPod; String[] podNameArray = { "Ruby Slippers", "BattleFish Bob", "BattleFish Barry", "Magic 8 Ball", "Mechanoid BattleFish", "BattleFish" }; String[] target1Array = { "Mechanoid BattleFish", "BattleFish", "Magic 8 Ball", "BattleFish Bob", "BattleFish Barry", "Ruby Slippers" }; String[] target2Array = { "Magic 8 Ball", "Mechanoid BattleFish", "BattleFish", "Ruby Slippers", "BattleFish Bob", "BattleFish Barry", }; String[] supportTargetArray = { "BattleFish Bob", "BattleFish Barry", "BattleFish Bob", "Mechanoid BattleFish", "Magic 8 Ball", "Mechanoid BattleFish" }; podBay[] podBayArray = new podBay[totalPodBays]; void setup() { size(800,600); background(255); noStroke(); hobo12 = loadFont("hobo-12.vlw"); currentPod = 0; battleReady = false; battleActive = false; p1power = 10; p2power = 10; bg = loadImage("bg.jpg"); p1info = loadImage("p1_info.jpg"); p2info = loadImage("p2_info.jpg"); p1chooseMove = loadImage("p1chooseMove.gif"); p1chooseMove_a = loadImage("p1chooseMove_a.gif"); p2chooseMove = loadImage("p2chooseMove.gif"); p2chooseMove_a = loadImage("p2chooseMove_a.gif"); ready = loadImage("ready.jpg"); notReady = loadImage("notReady.jpg"); dialogBox = loadImage("dialog.jpg"); //create the pod bays for (int i=0; i 2 && p2ChooseCounter > 2){ battleReady = true; } }//end if(chooseModeisActive) //BATTLE READY MODE if(battleReady){ String dialogString = "All pods are ready for Battle. \n Press any button to begin."; image(dialogBox, 205, 245); fill(233,0,254); textFont(hobo12, 12); textAlign(CENTER); text(dialogString, 205,275,360,160); } //BATTLE STATS MODE if(battleActive){ String dialogString = podBayArray[currentPod].name + " " + podBayArray[currentPod].action + " " + podBayArray[currentPod].targetName + "."; //fill(255); //rect(200,200,400,200); image(dialogBox, 205, 245); fill(233,0,254); textFont(hobo12, 12); textAlign(CENTER); text(dialogString, 205,275,360,160); }//end Battle Stats Mode [if (battleActive)] if(keyPressed){ //display the special info boxes if(key == '1'){ image(p1info,66,227); } else if(key =='2'){ image(p2info,66,261); } } } //end void draw() void keyPressed(){ if(chooseMovesisActive && p1ChooseCounter<3){ switch(key) { case 'f' : podBayArray[p1ChooseCounter].moveType = 1; podBayArray[p1ChooseCounter].updateText(); p1ChooseCounter++; break; case 'g' : podBayArray[p1ChooseCounter].moveType = 2; podBayArray[p1ChooseCounter].updateText(); p1ChooseCounter++; break; case 'a' : podBayArray[p1ChooseCounter].moveType = 3; podBayArray[p1ChooseCounter].updateText(); p1ChooseCounter++; break; case 'd' : podBayArray[p1ChooseCounter].moveType = 4; podBayArray[p1ChooseCounter].updateText(); p1ChooseCounter++; break; case 's' : podBayArray[p1ChooseCounter].moveType = 5; podBayArray[p1ChooseCounter].updateText(); p1ChooseCounter++; break; case 'r' : podBayArray[p1ChooseCounter].moveType = 6; podBayArray[p1ChooseCounter].updateText(); p1ChooseCounter++; break; } } if(chooseMovesisActive && p2ChooseCounter<3){ switch(keyCode) { case ALT : podBayArray[p2ChooseCounter+3].moveType = 1; podBayArray[p2ChooseCounter+3].updateText(); p2ChooseCounter++; break; case UP : podBayArray[p2ChooseCounter+3].moveType = 2; podBayArray[p2ChooseCounter+3].updateText(); p2ChooseCounter++; break; case LEFT : podBayArray[p2ChooseCounter+3].moveType = 3; podBayArray[p2ChooseCounter+3].updateText(); p2ChooseCounter++; break; case DOWN : podBayArray[p2ChooseCounter+3].moveType = 4; podBayArray[p2ChooseCounter+3].updateText(); p2ChooseCounter++; break; case RIGHT : podBayArray[p2ChooseCounter+3].moveType = 5; podBayArray[p2ChooseCounter+3].updateText(); p2ChooseCounter++; break; case CONTROL : podBayArray[p2ChooseCounter+3].moveType = 6; podBayArray[p2ChooseCounter+3].updateText(); p2ChooseCounter++; break; } } if(battleActive){ currentPod++; if(currentPod >= totalPodBays) { battleActive = false; battleReady = false; chooseMoves(); currentPod=0; } } if(battleReady){ performBattle(); } } void performBattle(){ battleActive=true; battleReady = false; }//end performBattle void chooseMoves(){ for (int i=0; i