never mind, fixed the problem with the bracket. but in keyPressed() I am getting the error
My sketch is called test.
int currentPage = 0;
Page[] pages = new Page[11]; //state how many pages there are.
PFont font;
int timelength = 8000;
boolean playing1, playing2;
void setup() {
size(864, 468, P3D);
background(0);
font = loadFont("TimesNewRomanPS-BoldMT-48.vlw"); //type of font.
textFont(font,24); //size of font.
for(int i = 0; i < pages.length; i++){
pages[i] = new Page(i+".mov", i+".jpg");
}
{
pages[0].setBodyText("You wake up in a forest. Cold, confused, alone. You have no idea how you ended up here. A dark presence raises the hairs on the back of your neck. Find a way to escape… with your life.\n\n\nup) travel down path right) walk into the trees"); // text for different pages set by BodyTExt string.
int[] options0 = {8,0,2};//set page number to go to with the corresponding variable in the keyPressed utilizing the chooseOption object.
pages[0].setOptions(options0);
pages[1].setBodyText("An icy river flows before you. Attempting to cross it could prove fatal; however, the presence you have been sensing seems to be drawing nearer…\n\n\nup) Cross river down) Go back");
int[] options1 = {8,8};
pages[1].setOptions(options1);
pages[2].setBodyText("As you journey deeper into the woods you feel more lost than ever before. A weathered cardboard box rests beside a tree. Your curiosity is overpowering, but your urge to flee increases by the second…\n\n\nup) Travel Deeper down) Open box");
int[] options2 = {8,3};
pages[2].setOptions(options2);
pages[3].setBodyText("The mysterious map reveals your precise location, as though someone, or something, is playing a game with you. With four directions to choose from surely one must lead to safety, but the others may lead to your demise…\n\n\nup) North down) South left) East right)West");
int[] options3 = {4,8,8,8};
pages[3].setOptions(options3);
pages[4].setBodyText("Hours of walking has resulted in sore feet and shortness of breath. Fatigue sets in like a disease, sapping you of strength. The road before you offers a glimmer of hope, but an abandoned car intensifies your suspicion that a pursuer is not far behind…\n\n\nup) Walk along a road down) Try door right) Check for key");
int[] options4 = {5,9,7};
pages[4].setOptions(options4);
pages[5].setBodyText("Traveling along the road has proven to be rewarding. A skateboard resting in the ditch might be the answer to your problems, however walking has brought you success thus far…\n\n\nup) Keep walking left) Examine bike");
int[] options5 = {8,5,5,8};
pages[5].setOptions(options5);
pages[6].setBodyText("The car appears empty. Fresh tire tracks mark the soft ground. Your impulse to escape overpowers your moral obligations, and it is clear that this vehicle is your only option left…\n\n\ndown) Try door up) Check for key");
int[] options6 = {3,2};
pages[6].setOptions(options6);
pages[7].setBodyText("As you sit in the driver’s seat you feel certain that you are not alone. Your adventure has left you parched, and an unknown beverage sitting in the cup holder could offer quick relief. The rear view mirror is adjusted incorrectly, however the thought of viewing whatever has been following you is petrifying…\n\n\ndown) Try the drink up) Check rear view mirror right) Start car");
int[] options7 = {8,8,10};
pages[7].setOptions(options7);
pages[8].setBodyText("\n\n\n Press any arrow key to restart");
int[] options8 = {0,0,0,0};
pages[8].setOptions(options8);
pages[9].setBodyText("Locked\n\n\n up)go backwards");
int[] options9 = {4};
pages[9].setOptions(options9);
pages[10].setBodyText("Shady man win? \n\n CONGRADULATIONS Press any arrow key to restart");
int[] options10 = {0,0,0,0};
pages[10].setOptions(options10);
}
/* // First movie is playing.
mov1 = new Movie(this, "backseatpsycho.mov");
mov1.play();
playing1 = true;
// Second movie is paused.
mov2 = new Movie(this, "0.mov");
mov2.pause();
playing2 = false;*/
}
void keyPressed() { // sets up different keys to choose different options when on a certian page.
if (key == CODED) {
if (keyCode == UP) {
pages[currentPage].chooseOption(0);
}else if (keyCode == DOWN) {
pages[currentPage].chooseOption(1);
}else if(keyCode == RIGHT){
pages[currentPage].chooseOption(2);
}else if(keyCode == LEFT){
pages[currentPage].chooseOption(3);
}
}
}
void movieEvent(Movie mov) {
mov.read();
}
void draw() {
background(0);
pages[currentPage].display();
myMovie = new Movie (this, nameMovie);
myMovie.play();
}