dsun

Untitled

Jan 30th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6. static Scanner jscan = new Scanner(System.in);
  7. static boolean game, warrior, archer, wizard;
  8. static String name, type;
  9. static int hp, maxHp, str, magic, agility, lvl;
  10.  
  11. public static void main(String[] args) {
  12.  
  13. System.out.print("Name: ");
  14. name = jscan.nextLine().toLowerCase();
  15.  
  16. System.out.println("Pick a class\n[W]arrior, [A]rcher, W[i]zard");
  17. type = jscan.nextLine().toLowerCase();
  18. game = true;
  19.  
  20. while(game == true){
  21.  
  22. if(type.equals("w")){
  23. warrior();
  24. }else if(type.equals("a")){
  25. archer();
  26. }else if(type.equals("i")){
  27. wizard();
  28. }else{
  29. System.out.println("Try again!");
  30. type = jscan.nextLine().toLowerCase();
  31. }
  32.  
  33. }
  34. }
  35.  
  36. static void warrior(){
  37. System.out.println("You chose the warrior class\n");
  38. hp = 10;
  39. maxHp = 10;
  40. str = 5;
  41. lvl = 1;
  42. warrior = true;
  43. System.out.println("Name: " + name + "\nClass: Warrior\nLVL: " + lvl + "\nHP: " + hp + "/" + maxHp + "\nSTR: " + str);
  44. game = false;
  45. }
  46.  
  47. static void archer(){
  48. System.out.println("You chose the archer class\n");
  49. hp = 10;
  50. maxHp = 10;
  51. agility = 5;
  52. lvl = 1;
  53. archer = true;
  54. System.out.println("Name: " + name + "\nClass: Archer\nLVL: " + lvl + "\nHP: " + hp + "/" + maxHp + "\nAGI: " + agility);
  55. game = false;
  56. }
  57.  
  58. static void wizard(){
  59. System.out.println("You chose the wizard class\n");
  60. hp = 10;
  61. maxHp = 10;
  62. magic = 5;
  63. lvl = 1;
  64. wizard = true;
  65. System.out.println("Name: " + name + "\nClass: Wizard\nLVL: " + lvl + "\nHP: " + hp + "/" + maxHp + "\nMAG: " + magic);
  66. game = false;
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment