dsun

Untitled

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