Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- static Scanner jscan = new Scanner(System.in);
- static boolean game, warrior, archer, wizard;
- static String name, type;
- static int hp, maxHp, str, magic, agility, lvl;
- public static void main(String[] args) {
- System.out.print("Name: ");
- name = jscan.nextLine().toLowerCase();
- System.out.println("Pick a class\n[W]arrior, [A]rcher, W[i]zard");
- type = jscan.nextLine().toLowerCase();
- game = true;
- while(game == true){
- if(type.equals("w")){
- warrior();
- }else if(type.equals("a")){
- archer();
- }else if(type.equals("i")){
- wizard();
- }else{
- System.out.println("Try again!");
- type = jscan.nextLine().toLowerCase();
- }
- }
- }
- static void warrior(){
- System.out.println("You chose the warrior class\n");
- hp = 10;
- maxHp = 10;
- str = 5;
- lvl = 1;
- warrior = true;
- System.out.println("Name: " + name + "\nClass: Warrior\nLVL: " + lvl + "\nHP: " + hp + "/" + maxHp + "\nSTR: " + str);
- game = false;
- }
- static void archer(){
- System.out.println("You chose the archer class\n");
- hp = 10;
- maxHp = 10;
- agility = 5;
- lvl = 1;
- archer = true;
- System.out.println("Name: " + name + "\nClass: Archer\nLVL: " + lvl + "\nHP: " + hp + "/" + maxHp + "\nAGI: " + agility);
- game = false;
- }
- static void wizard(){
- System.out.println("You chose the wizard class\n");
- hp = 10;
- maxHp = 10;
- magic = 5;
- lvl = 1;
- wizard = true;
- System.out.println("Name: " + name + "\nClass: Wizard\nLVL: " + lvl + "\nHP: " + hp + "/" + maxHp + "\nMAG: " + magic);
- game = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment