Пример #1
0
 private int lookFor(
     String string,
     int current) { // find the next point value this method is redundant and can easily be taken
   // out
   for (int i = current; i < p.Story.size(); i++) // starts where we are and goes to end
   {
     // System.out.println(p.Story.get(i));
     if (p.Story.get(i).startsWith(string)) // found the points
     {
       return i; // return where we are
     }
   }
   return 100; // this should never happen
 }
Пример #2
0
  public void progress() // Function that goes to the next step in the story
      {
    if (state == 3) return;

    //		ap.play("/Resources/Music/Scrollsound.mp3"); //THIS SHIT DOESN'T WORK WHAT THE F**K DEHOWE
    String name; // Name of the char
    String quote; // Current quote
    if (index
        < p.Story.size()
            - 1) // Makes sure no index out of bounds errors happen (they shouldn't anyway)
    {
      working = p.Story.get(index); // Sets up the string we are working with
      if (working.equals("ending")) // checks if we are at the end
      {
        oldbg = bg;
        try {
          URL url = getClass().getResource("B0.png");
          bg = ImageIO.read(url);
        } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        state = 3; // Sets end state
        System.out.println("End"); // For the text part of game
        return; // Exits
      }
      System.out.println(tag);
      tag = working.substring(0, working.indexOf(']')); // Makes the tag
      if (working.contains("&")) // If there is a person talking
      {
        name =
            working.substring(
                working.indexOf(']') + 1, working.indexOf('&')); // Set the person's name
        quote = working.substring(working.indexOf('&') + 1); // Set the quote
        display(name, quote); // Shows the quote on the screen
        index = next(tag, index); // Sets index
      } else if (working.contains(">")) // if it's an option
      {
        display(working); // call the options display
      } else // no name story line
      {
        name = "";
        quote = working.substring(working.indexOf(']') + 1);
        display(name, quote);
        index = next(tag, index); // sets up to be called again
      }
    }
  }
Пример #3
0
 private int lookFor(String string) { // find the next part of the story
   System.out.println(string);
   System.out.println(index);
   for (int i = index + 1;
       i < p.Story.size();
       i++) // starts where we are and goes to the end of the story
   {
     // System.out.println(p.Story.get(i));
     if (p.Story.get(i).contains(string)) // found the string
     {
       System.out.println(i);
       return i; // return where we are
     }
   }
   return 100; // this should never happen
 }