Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Tutorial{
- //data members
- private int room = 0;
- private String user, output;
- private Player player;
- private Inventory inventory;
- private boolean tut = true;
- private boolean tut1 = true;
- private boolean gift = true;
- private Scanner scanner = new Scanner(System.in);
- //constructor
- public Tutorial(Player p, Inventory i){
- player = p;
- inventory = i;
- }
- //methods
- public String intro(){
- return "\nAh, yes! A young adventurer! Well, things around here aren't so difficult.\n" +
- "Most of us are farmers, but from time to time, an adventurer like you pops up!\n " +
- "At any time during the game, type 'info' to see your personal information.";
- } public String tut(){
- while(tut){
- System.out.println("\nType 'info' now.");
- user = scanner.next();
- if (user.equalsIgnoreCase("info")){
- output = "" + player.toString() + "\nVery good! Now that wasn't so hard!";
- tut = false;
- } else {
- output = "\nPlease type 'info' now.";
- }
- }
- return output;
- } public String tut1(){
- while(tut1){
- System.out.println("\nHow about typing in 'inventory'?");
- user = scanner.next();
- if(user.equalsIgnoreCase("inventory")){
- output = "" + inventory.toString() +
- "\nGreat! These are all of your items. You can buy more at the store.\n" +
- "Perfect! Almost done! The last thing to do is to choose an item. You'll have" +
- "\nplenty of opportunities to get these items later on in the game, but consider this\n" +
- "";
- tut1 = false;
- } else {
- output = "\nPlease type 'inventory' now.";
- }
- }
- return output;
- }
- public String gift(){
- while (gift){
- System.out.println("\nWhich item do you choose?\nSword\nPotions\nCoins");
- user = scanner.next();
- if(user.equalsIgnoreCase("sword")){
- inventory.gainSword(1);
- output = "\nGood choice. Off you go then!";
- gift = false;
- } else if(user.equalsIgnoreCase("potions")){
- inventory.gainPotion(10);
- output = "\nGood choice. Off you go then!";
- gift = false;
- } else if(user.equalsIgnoreCase("coins")){
- inventory.gainCoins(50);
- output = "\nGood choice. Off you go then!";
- gift = false;
- } else {
- output = "\nDon't be greedy! Choose from what you're offered.";
- }
- }
- return output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement