Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import io.*;
- import java.io.*;
- public class TextAdventure
- {
- private TextFile text;
- private Choices option;
- private String directory;
- public TextAdventure (String folder)
- {
- directory = folder;
- text = new TextFile(directory+"/START.txt");
- option = new Choices(directory+"/START_opt.csv");
- }
- public void printCase()
- {
- text.printStory();
- option.printOptions();
- }
- public void getNextScene(int choice)
- {
- int lastIdx;
- String next;
- if(choice > option.getNumChoices())
- {
- throw new IllegalArgumentException("Invalid choice.");
- }
- else
- {
- lastIdx = option.getLastIdx(choice -1);
- next = option.nextScene((choice -1) , lastIdx);
- text.readScene(next+".txt");
- option.readOptions(next+"_opt.csv");
- }
- }
- }
Add Comment
Please, Sign In to add comment