Advertisement
anudrul

Revenge of the hippos: Beta version 1.3

Jul 12th, 2013
905
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import acm.util.RandomGenerator;
  2. import java.util.Scanner;
  3.  
  4.  
  5. public class textw {
  6.  
  7.        
  8.        
  9.        
  10.         public static boolean sword=false;  
  11.        
  12.         public static boolean armor=false;
  13.        
  14.         public static boolean coin=false;
  15.        
  16.         public static boolean Document=false;
  17.        
  18.         public static boolean Documenttwo=false;
  19.        
  20.         public static boolean BabyHippo=false;
  21.        
  22.        
  23.        
  24.        
  25.        
  26.        
  27.        
  28.         public static void main(String[] args){
  29.             System.out.println("Welcome to Attack of the hippos v1.1 (there is currently only one main story line to follow)");  
  30.             System.out.println("You can not use caps in this game");
  31.             System.out.println("");
  32.             levelone();
  33.        
  34.         }
  35.  
  36.         private static RandomGenerator rgen = RandomGenerator.getInstance();
  37.        
  38.  
  39.          private static String getinput() {
  40.                 Scanner keyboard= new Scanner(System.in);
  41.                 String input= keyboard.nextLine();                      
  42.                 return input;                                  
  43.                
  44.        
  45.                
  46.         }
  47.        
  48.        
  49.         private static void levelzero(){
  50.             System.out.println("Thank you for playing Revenge of the Hippos. ");
  51.             System.out.println("");
  52.             System.out.println("This game has been coded by Alexander Chow with the help of TA Richard, and the rest of DMA. :)  ");
  53.             System.out.println("");
  54.             System.out.println("To retry the game please type in [Restart]");
  55.             String playerinput=getinput();
  56.            
  57.             if (playerinput.equalsIgnoreCase("Restart")){
  58.                 sword=false;
  59.                 Document=false;
  60.                 Documenttwo=false;     
  61.                
  62.                 levelone();
  63.             }
  64.            
  65.             else{
  66.                 System.out.println("");
  67.                 System.out.println("");
  68.                 System.out.println("Thanks for coming, we hope to see you again!");
  69.             }
  70.             }
  71.        
  72.         private static void levelone() {
  73.                 System.out.println("You are in the ruins of your village");
  74.             System.out.println("A village elder explains that Rampaging hipos have destroyed your village, and that he needs you to come talk when ready.");
  75.                 String playerinput=getinput(); // setting our variable, playerinput, of type String, to what the player types in
  76.             System.out.println(playerinput);
  77.             if(playerinput.contains("talk")){
  78.                System.out.println("Village elder: I need you to go Hearl city and ask for aid.");                  
  79.                 leveltwo();
  80.             }
  81.             else if (playerinput.contains("ready")){
  82.                 System.out.println("Village elder: I need you to go to Hearl city and ask for aid.");
  83.                  leveltwo();
  84.         }
  85.            
  86.             else if(playerinput.contains("leveltwentyone")){
  87.             leveltwentyone();
  88.             }
  89.                
  90.            
  91.            
  92.                
  93.                 else{
  94.                         System.out.println("Invalid move, you bumbling buffoon.");
  95.                         levelone();
  96.                 }
  97.         }
  98.  
  99.         private static void leveltwo() {
  100.                 System.out.println("You exit the village entering a grassy field");
  101.                 System.out.println("You see a cross road runs throug the path showing 3 directions: South,North(Hearl city) and West");
  102.                 String playerinput=getinput();
  103.                
  104.                 if
  105.                    (playerinput.equalsIgnoreCase("North")){
  106.                         levelthree();
  107.                 }
  108.        
  109.                 else if
  110.                         (playerinput.equalsIgnoreCase("West")){
  111.                     levelfour();
  112.                 }
  113.            
  114.                 else if
  115.                      (playerinput.equalsIgnoreCase("South")){
  116.                          levelsix();
  117.                 }
  118.                
  119.                 else{
  120.                         System.out.println("Invalid move, you bumbling buffoon.");
  121.                       leveleight();
  122.                 }
  123.         }
  124.  
  125.         private static void levelthree() {
  126.                 System.out.println("Heading north you arive at the gates of the city of Hearl.");
  127.                 String playerinput=getinput();
  128.                 if(playerinput.contains("enter")){
  129.             System.out.println("Guard:Only those with the proper documents may pass.");
  130.             if (Document == true){
  131.                 System.out.println("Guard: Oh you have them, you may pass");
  132.                   leveltwentythree();
  133.             }
  134.            
  135.             if (Documenttwo == true) {
  136.             System.out.println("Guard: Oh you have them,  you may pass");
  137.             leveltwentyfour();
  138.             }
  139.            
  140.            
  141.                 else {
  142.                 System.out.println("Guard: You have no papers, SCRAM!");
  143.                    leveleight();
  144.             }
  145.                        
  146.                 }
  147.                
  148.                
  149.                
  150.                 else if
  151.                      (playerinput.contains("south")){
  152.                            leveleight();
  153.                 }
  154.                
  155.                 else{
  156.                         System.out.println("Invalid move, you bumbling buffoon");
  157.                           levelthree();
  158.                 }
  159.                        
  160.        
  161.         }
  162.  
  163.         private static void levelfour() {
  164.                 System.out.println("You arive in a open plain");
  165.                 System.out.println("Either Explore or leave");
  166.             String playerinput=getinput();
  167.            
  168.             if (playerinput.contains("explore")){
  169.                 System.out.println(" you find a man fighting a ugly looking hippo.");
  170.                 System.out.println("Either aid him or flee");
  171.                 leveltwentyfive();
  172.             }
  173.            
  174.             else if(playerinput.contains("leave")){
  175.                 System.out.println("You leave wondering what you could have found");
  176.                 leveleight();
  177.             }
  178.                  
  179.            
  180.        
  181.             else{
  182.                 System.out.println("Invalid move, you bumbling buffoon.");
  183.                 levelfour();
  184.             }  
  185.         }
  186.        
  187.         private static void levelfive() {
  188.                 System.out.println("Fallen Man: I tracked the beast after it attacked my village, south of the crossroads.");
  189.                 System.out.println("Fallen Man: Please let them know where I am");
  190.                 System.out.println("");
  191.                 System.out.println("You recieved Quest:Help me");
  192.                 leveleight();
  193.                
  194.                
  195.         }
  196.  
  197.         private static void levelsix() {
  198.                 System.out.println("Heading south you find a rocky canyon entrance that has been blocked by a boulder.");
  199.                 System.out.println("search around for a way around or leave?");
  200.             String playerinput=getinput();
  201.            
  202.             if (playerinput.contains("leave")){
  203.                 leveleight();
  204.             }
  205.        
  206.             else {
  207.                 System.out.println("You find nothing while searching.");
  208.                 levelseven();
  209.          
  210.            
  211.            
  212.            
  213.        
  214.         }
  215. }
  216.  
  217.         private static void levelseven() {
  218.         System.out.println("Keep searching or leave?");
  219.         String playerinput=getinput();
  220.        
  221.         if(playerinput.contains("searching")){
  222.                 System.out.println("You find a small cave entrance and enter it");
  223.                 levelnine();
  224.                 }
  225.        
  226.         else{
  227.                 System.out.println("You give up heading back.");
  228.                 levelnine();
  229.         }
  230.        
  231.        
  232.         }
  233.  
  234.         private static void leveleight() {
  235.                 System.out.println("You see a cross road runs throug the path showing 3 directions: South,North and West");
  236.                 String playerinput=getinput();
  237.                
  238.                 if
  239.                    (playerinput.equalsIgnoreCase("North")){
  240.                         levelthree();
  241.                 }
  242.        
  243.                 else if
  244.                         (playerinput.equalsIgnoreCase("West")){
  245.                     levelfour();
  246.                 }
  247.            
  248.                 else if
  249.                      (playerinput.equalsIgnoreCase("South")){
  250.                          levelsix();
  251.                 }
  252.                
  253.                 else{
  254.                         System.out.println("Invalid move, you bumbling buffoon.");
  255.                       leveleight();
  256.                 }
  257.         }
  258.  
  259.         private static void levelnine() {
  260.                 System.out.println("Entering into the cave you quickly become entangled in the spider webs hanging every where");
  261.            
  262.            
  263.             if (sword==true) {
  264.                 System.out.println("Your sword easily slices through the webs allowing you to free yourself");
  265.                 System.out.println("However the blade snaps as you finish making you sad :(");
  266.                 sword=false;
  267.                 levelten();
  268.                
  269.             }
  270.            
  271.             else {
  272.                 System.out.println("Not being able to free yourself you black out from a lack of oxygen.");
  273.                 System.out.println("Error 404:page not found.");
  274.                 levelzero();
  275.                
  276.             }
  277.         }
  278.  
  279.         private static void levelten() {
  280.                 System.out.println("Having escaped you hurry down the tunnel and burst out onto another adbandoned cross road.");
  281.                 System.out.println("You have three options: Go up,right or left.");
  282.                 String playerinput=getinput();
  283.        
  284.           if (playerinput.contains("up")){
  285.                   System.out.println("Heading up the hill you find and climb into a old,ugly tower.");
  286.                   leveleleven();
  287.                    }
  288.           else if (playerinput.contains("right")){
  289.               System.out.println("Turning right you find a dead end, you turn around dejected.");
  290.               leveltwelve();
  291.           }
  292.          
  293.           else if (playerinput.contains("left")){
  294.                   System.out.println("In your hurry to rush around the cliff, you trip and knock yourself out. ");
  295.              
  296.           }
  297.                
  298.         }
  299.  
  300.         private static void leveleleven() {
  301.             System.out.println("There is nothing in the tower, go away");
  302.             levelthirteen();
  303.                
  304.         }
  305.  
  306.         private static void leveltwelve() {
  307.                 System.out.println("You come back out of the dead end feeling sad.");
  308.                 System.out.println("You have three options: Go up,right or left.");
  309.                 String playerinput=getinput();
  310.        
  311.           if (playerinput.contains("up")){
  312.                   System.out.println("Heading up the hill you find and climb into a old,ugly tower.");
  313.                   leveleleven();
  314.                    }
  315.           else if (playerinput.contains("right")){
  316.               System.out.println("Turning right you find a dead end, you turn around dejected.");
  317.               leveltwelve();
  318.              }
  319.          
  320.           else if (playerinput.contains("left")){
  321.                   System.out.println("In your hurry to rush around the cliff, you trip and knock yourself out. ");
  322.                   levelfourteen();
  323.           }
  324.                
  325.           else {
  326.                   System.out.println("Invalid move, you bumbling buffon");
  327.                   leveltwelve();
  328.           }
  329.        
  330.         }
  331.  
  332.         private static void levelthirteen() {
  333.             System.out.println("You come back out of the tower feeling sad.");
  334.             System.out.println("You have three options: Go up,right or left.");
  335.             String playerinput=getinput();
  336.    
  337.       if (playerinput.contains("up")){
  338.               System.out.println("Heading up the hill you find and climb into a old,ugly tower.");
  339.               leveleleven();
  340.                }
  341.       else if (playerinput.contains("right")){
  342.           System.out.println("Turning right you find a dead end, you turn around dejected.");
  343.           leveltwelve();
  344.          }
  345.      
  346.       else if (playerinput.contains("left")){
  347.               System.out.println("In your hurry to rush around the cliff, you trip and knock yourself out. ");
  348.               levelfourteen();
  349.       }
  350.            
  351.       else {
  352.               System.out.println("Invalid move, you bumbling buffon");
  353.               levelthirteen();
  354.       }
  355.    
  356.     }
  357.  
  358.         private static void levelfourteen(){
  359.             System.out.println("You wake up in the same spot as before with a pounding head.");
  360.             System.out.println("Either go back to sleep or try and get up");
  361.             String playerinput=getinput();    
  362.            
  363.             if (playerinput.contains("up")){
  364.                 System.out.println("You wake up from your dream and glance around, your in a small hut. ");
  365.                 System.out.println("Either leave hut or wait for something to happen");
  366.             }
  367.            
  368.             else if (playerinput.contains("leave")){
  369.                 System.out.println("As you leave the hut a man approachs you warrily. ");
  370.                 levelfifteen();
  371.             }
  372.            
  373.             else if (playerinput.contains("wait")){
  374.                 System.out.println("While waiting you fall back asleep");
  375.                 levelfourteen();
  376.             }
  377.            
  378.             else {
  379.                 System.out.println("Invalid move, you bumbling buffon");
  380.                 levelfourteen();
  381.         }
  382.        
  383.         }
  384.  
  385.         private static void levelfifteen(){
  386.             System.out.println("The man motions you to follow him into a hut");
  387.             System.out.println("Either follow him or make a run for it");
  388.             String playerinput=getinput();
  389.            
  390.             if (playerinput.contains("follow")){
  391.                 System.out.println("Following the man into the hut you notice it's empty.");
  392.                 System.out.println("This is the end of this story line for now sorry :( (you must die, sorry)");
  393.                 levelzero();
  394.             }
  395.            
  396.             else if(playerinput.contains("run")){
  397.                 System.out.println("As the man turns his back you run for the hills and disappear into the rocks.");
  398.                 levelsixteen();
  399.             }
  400.        
  401.             else {
  402.                 System.out.println("Invalid command, you bumbling buffoon.");
  403.                 levelfifteen();        
  404.             }
  405.         }
  406.  
  407.         private static void levelsixteen(){
  408.             System.out.println("Exhausted you fall slumped against a pile of rocks and glance around you notice that hippo tracks are in the ground!");
  409.             System.out.println("Either follow the tracks or follow the path out of the hills/dessert");
  410.             String playerinput=getinput();
  411.            
  412.             if (playerinput.contains("tracks")){
  413.                 System.out.println("You follow the tracks to a hiddeon oasis when the ground suddenly gives out frome under you!");
  414.                 levelseventeen();
  415.                        }
  416.             else if (playerinput.contains("path")){
  417.                 System.out.println("The path seems to just go on and on, eventualy you notice a small cluster of buildings and stumble towards them");
  418.                 leveltwentyone();                
  419.             }
  420.            
  421.             else {
  422.                 System.out.println("Invalid move, you bumbling buffoon.");
  423.                 levelsixteen();
  424.             }
  425.        
  426.         }
  427.  
  428.         private static void levelseventeen(){
  429.             System.out.println("The rocks above the oaisis your standing on collapse and send you tumbling down the hill into a group of Hippos!");
  430.             System.out.println("");
  431.             System.out.println("The Hippos quickly surround you and demand you to surrender. Either comply or resist ");
  432.             String playerinput=getinput();
  433.            
  434.             if (playerinput.contains("comply")){
  435.                 System.out.println("Satisfied with your compliance the hippos put you into a cave and block it off with a boulder");
  436.                 levelnineteen();
  437.             }
  438.            
  439.             else if(playerinput.contains("resist")){
  440.                 System.out.println("impressed with your courage the group agrees to take you to their leader");
  441.                 leveltwenty();
  442.             }
  443.            
  444.             else{
  445.                 System.out.println("Invalid move, Do you want to die?");
  446.                 leveleighteen();
  447.             }
  448.            
  449.              
  450.         }
  451.  
  452.         private static void leveleighteen(){
  453.         System.out.println("The hippos await your action");
  454.         System.out.println("either surrender or resist");
  455.         String playerinput=getinput();
  456.        
  457.         if (playerinput.contains("surrender")){
  458.             System.out.println("Satisfied with your compliance the hippos put you into a cave and block it off with a boulder");
  459.             levelnineteen();
  460.         }
  461.        
  462.         else if(playerinput.contains("resist")){
  463.             System.out.println("impressed with your courage the group agrees to take you to their leader");
  464.             leveltwenty();
  465.         }
  466.        
  467.         else{
  468.             System.out.println("Invalid move, Do you want to die?");
  469.             leveleighteen();
  470.         }
  471.        
  472.        
  473.         }
  474.  
  475.         private static void levelnineteen(){
  476.             System.out.println("The hippos keep you alive, but you never escape. The fate of your people is now hidden from you");
  477.             levelzero();
  478.         }
  479.  
  480.         private static void leveltwenty() {
  481.             System.out.println("They take you into a cave and them from there the hippos push you into a smaller off-shoot.\n there is a dark 'hippo' shape in the corner./n Hippo shaped figure: I need you to do a mission for me, if you fail it i will track you down and HUG you.");
  482.             System.out.println("Hippo shaped figure:Your mission is to take a message to one of my contacts inside Hearl city. /n here is some Documents to get you into the city ");
  483.             Document=true;
  484.             leveleight();
  485.         }
  486.  
  487.         private static void leveltwentyone(){
  488.             System.out.println("Inside the village you find a  enchanted stone, pick it up or no?");        
  489.             String playerinput=getinput();          
  490.            
  491.         if (playerinput.equalsIgnoreCase("pick it up")){
  492.             int x = rgen.nextInt(4);    
  493.             //
  494.         if (x==0) {
  495.             System.out.println("The stone glows red and hands you a Document!");
  496.             Documenttwo=true;
  497.             leveleight();}
  498.         //
  499.         if (x==1){
  500.             System.out.println("Nothing happens and you are teleported back to the rocks" );
  501.             leveltwentytwo();}      
  502.         //
  503.         if (x==2) {
  504.             System.out.println("The stone glows red and hands you a Document!");
  505.             Documenttwo=true;
  506.             leveleight();}
  507.         //
  508.         if (x==3){
  509.             System.out.println("You are teleported");
  510.             levelone();
  511.         }
  512.     }
  513.        
  514.        
  515.        
  516.         else if(playerinput.contains("no")){
  517.         levelsixteen();
  518.         }
  519.        
  520.         else{
  521.             System.out.print("What did you just do??");
  522.             leveltwentyone();        
  523.         }
  524.        
  525.         }
  526. //Copy of level 16 after strange stone event
  527.         private static void leveltwentytwo(){
  528.             System.out.println("Exhausted you fall slumped against a pile of rocks and glance around you notice that hippo tracks are in the ground!");
  529.             System.out.println("You must follow the hipo tracks");
  530.             String playerinput=getinput();
  531.            
  532.             if (playerinput.contains("tracks")){
  533.                 System.out.println("You follow the tracks to a hiddeon oasis when the ground suddenly gives out frome under you!");
  534.                 levelseventeen();
  535.                        }
  536.                          
  537.            
  538.             else {
  539.                 System.out.println("Invalid move, you bumbling buffoon.");
  540.                 levelsixteen();
  541.             }
  542.        
  543.         }
  544.  
  545.         private static void leveltwentythree(){
  546.             System.out.println("Thanks for enterinh Hearl city with Documents going with story line 'Heroes of the hippo' ");
  547.             levelzero();
  548.         }
  549.  
  550.         private static void leveltwentyfour(){
  551.         System.out.println("Thanks for entering Hearl city with Documents going with story ling 'Heroes of man'");
  552.         levelzero();
  553.         }
  554.        
  555.         private static void leveltwentyfive() {
  556.         String playerinput=getinput();   
  557.            
  558.              if(playerinput.contains("aid")){
  559.                    System.out.println("You reach the man just as he collapses, you slay the hippo with his sword");
  560.                    System.out.println("You gained: The Sword!");
  561.                    sword=true;
  562.                    levelfive();  
  563.                }
  564.              
  565.                else if
  566.                      (playerinput.contains("flee")){
  567.                      System.out.println("You Escaped!");
  568.                      leveleight();
  569.                }
  570.         }
  571.  
  572.         private static void leveltwentsix(){
  573.            
  574.         }
  575. }
Advertisement
RAW Paste Data Copied
Advertisement