This is my code for the choose your own adventure game. I have the images and text set up as an array for each page and the key pressed function works to go through the different page objects. Was just hoping to get help with when your on a page and you press an arrow key, a video will play and then go to the next page.
Would really appreciate the help
int currentPage = 0;
Page[] pages = new Page[11]; //state how many pages there are.
import processing.video.*;
PFont font;
int timelength = 8000;
Movie mov1, mov2;
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");
}
{
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");