Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class UnadvancedDnD {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.print("Please enter an action: ");
- String action = sc.nextLine();
- int work = 0;
- while (work == 0) {
- if (action.equals("x")) {
- System.out.println("Bye!");
- work++;
- }
- else if (action.equals("u")) {
- System.out.println("You go one square up.");
- work++;
- }
- else if (action.equals("d")) {
- System.out.println("You go one square down.");
- work++;
- }
- else if (action.equals("l")) {
- System.out.println("You go one square left.");
- work++;
- }
- else if (action.equals("r")) {
- System.out.println("You go one square right.");
- work++;
- }
- else if (action.equals("s")) {
- System.out.println("You search the square for treasure. You find nothing.");
- work++;
- }
- else if (action.equals("h")) {
- System.out.println("You hide, waiting for enemies to come by. It gets boring after about an hour and a half, so you give up.");
- work++;
- }
- else if (action.equals("e")) {
- System.out.println("You eat some food. You regain 0 hit points.");
- work++;
- }
- else {
- System.out.println("I don't understand.");
- work++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement