Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package exercise;
- import javax.swing.JOptionPane;
- public class Exercise {
- public static void main(String[] args) {
- String first_name;
- first_name= JOptionPane.showInputDialog("Enter your first name");
- String last_name;
- last_name= JOptionPane.showInputDialog("Enter your last name");
- String name;
- name="Your name is " + first_name + " " + last_name + ". Welcome to JavaQuest alpha 0.1!";
- JOptionPane.showMessageDialog(null, name);
- String weapon;
- weapon= JOptionPane.showInputDialog("What is your weapon of choice?");
- String weapon_accept;
- weapon_accept= "Your permanent weapon will be a " + weapon;
- JOptionPane.showMessageDialog(null, weapon_accept);
- JOptionPane.showMessageDialog(null, "Good luck with the game!");
- JOptionPane.showMessageDialog(null, "game is loading.... please wait");
- JOptionPane.showMessageDialog(null, "Your name is " + first_name + " " + last_name + "." + " You stand in your room. It is your birthday. There are several items around you. Next to you is your " + weapon + ".");
- String pickup_weapon;
- pickup_weapon= JOptionPane.showInputDialog("Pick up " + weapon + "? Yes/No");
- switch (pickup_weapon) {
- case "Yes":
- JOptionPane.showMessageDialog(null, "You picked up the " + weapon );
- break;
- case "No":
- JOptionPane.showMessageDialog(null, "Second thoughts arose in your mind. You picked up the " + weapon + " anyway.");
- break;
- }
- JOptionPane.showMessageDialog(null, "You are now armed with your " + weapon + ". You then hear a noise outside your room.");
- String noise_check;
- noise_check = JOptionPane.showInputDialog("checkout noise? yeah/nah/I don't know");
- switch (noise_check) {
- case "yeah":
- JOptionPane.showMessageDialog(null, "You ready your " + weapon + " and head out the door to inspect the noise.");
- JOptionPane.showMessageDialog(null, "With your " + weapon + " in hand, you inspect the dark alleyway that's located near your room in this run-down apartment.");
- String action_huntmonster= JOptionPane.showInputDialog("The source of the noise appears. It is a shadow sneaker, a type of monster that has dark skin and is really slender. What will you do? Use weapon/Interrogate/attack relentlessly");
- switch (action_huntmonster) {
- case "Use weapon":
- JOptionPane.showMessageDialog(null, "You begin using your " + weapon + " in an attempt to defeat the intruder, but your efforts weren't good enough. The monster fled.");
- break;
- case "Interrogate":
- JOptionPane.showMessageDialog(null, "You begin asking questions. The monster seems confused by your shaky attempts to communicate with it. The monster has let its guard down.");
- JOptionPane.showMessageDialog(null, "The monster is still confused and begins approaching you slowly.");
- String action_communication= JOptionPane.showInputDialog("ready weapon/continue questioning/surprise attack");
- switch(action_communication) {
- case "ready weapon":
- JOptionPane.showMessageDialog(null, "The monster approaches. It is getting too close for comfort.");
- JOptionPane.showMessageDialog(null, "Just as you were readying your " + weapon + ", your neighbor comes out of her room. She starts greeting you in a very loud voice,- She's been drinking.");
- JOptionPane.showMessageDialog(null, "Surprised by the sudden interruption, the shadow lurker flees. You lost your chance to kill it.");
- JOptionPane.showMessageDialog(null, "You then go back into your room. You are now bored.");
- JOptionPane.showMessageDialog(null, "...");
- JOptionPane.showMessageDialog(null, "The next day you continue your life as a boring person. You never got the chance to experience anything exciting. Game over.");
- System.exit(0);
- break;
- case "continue questioning":
- JOptionPane.showMessageDialog(null, "The monster approaches. It is getting too close for comfort.");
- String action_confront= JOptionPane.showInputDialog("What are you going to do now? attack/run");
- switch (action_confront) {
- case "attack":
- JOptionPane.showMessageDialog(null, "You proceed to use your " + weapon + ". The monster was too surprised to retaliate. You managed to completely kill it.");
- JOptionPane.showMessageDialog(null, "Congratulations on your first kill! :) ");
- String player_status= "Alive";
- JOptionPane.showMessageDialog(null, "....");
- JOptionPane.showMessageDialog(null, "You go back to your room.");
- JOptionPane.showMessageDialog(null, "You are now too tired to stay up any later. You decide to go to bed.");
- JOptionPane.showMessageDialog(null, "....");
- JOptionPane.showMessageDialog(null, "It's morning already, and you were waken up by the loud chat notification on your computer.");
- JOptionPane.showMessageDialog(null, ".....");
- JOptionPane.showMessageDialog(null, "It's a message from your one of your long-distance friends whom you got to know from this multiplayer game called MINECRAFT.");
- JOptionPane.showMessageDialog(null, "You try to remember his real name... ");
- String buddy_gender= JOptionPane.showInputDialog("Wait, was it even a he? he/her");
- String buddy= JOptionPane.showInputDialog("And... What was " + buddy_gender + " name again?");
- JOptionPane.showMessageDialog(null, "Chatlog:");
- JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: Hiya! :D");
- JOptionPane.showMessageDialog(null, "You: So " + buddy + ", what made you message me so early in the morning?");
- JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: I just wanted to tell you that I heard this loud noise last night outside of my student dormitory room.");
- String reply_one= JOptionPane.showInputDialog("Reply: you too?/wow/IDC/what?");
- switch (reply_one) {
- case "you too?":
- JOptionPane.showMessageDialog(null, "You: There was one at your house too?");
- JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: ...one what? The sound?");
- JOptionPane.showMessageDialog(null, "You: Well yeah. What else would I be referring to?");
- JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: You mean you heard it too?");
- System.exit(0);
- case "wow":
- JOptionPane.showMessageDialog(null, "You: Oh wow, okay. So what was it?");
- JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: Oh well... it was just a cat scratching on the door.... nothing special.");
- System.exit(0);
- case "IDC":
- JOptionPane.showMessageDialog(null, "You: Right-right.... another one of those beings from hell?");
- JOptionPane.showMessageDialog(null, "WhitevanIcecreamPerson: what?");
- System.exit(0);
- }
- System.exit(0);
- break;
- case "run":
- JOptionPane.showMessageDialog(null, "You decided to run....");
- JOptionPane.showMessageDialog(null, "Smart move. You have forgotten that the monster has a slender body, so there is a chance that that thing will be super fast.");
- JOptionPane.showMessageDialog(null, "The monster is now chasing you down. Game over.");
- System.exit(0);
- break;
- }
- case "surprise attack":
- JOptionPane.showMessageDialog(null, "The monster retaliates and severs your arm that was used to hold the weapon. You drop down to the floor from the pain. The monster flees.");
- JOptionPane.showMessageDialog(null, "...");
- JOptionPane.showMessageDialog(null, "The next day, your neighbor has found your cold dead body. You died from severe blood loss, as you laid on the floor in the same spot since last night.");
- JOptionPane.showMessageDialog(null, "You have died. game over.");
- System.exit(0);
- break;
- }
- break;
- default:
- JOptionPane.showMessageDialog(null, "The monster retaliates and severs your arm that was used to hold the weapon. You drop down to the floor from the pain. The monster flees.");
- JOptionPane.showMessageDialog(null, "...");
- JOptionPane.showMessageDialog(null, "The next day, your neighbor has found your cold dead body. You died from severe blood loss, as you laid on the floor in the same spot since last night.");
- JOptionPane.showMessageDialog(null, "You have died. game over.");
- System.exit(0);
- }
- break;
- case "nah":
- JOptionPane.showMessageDialog(null, "You holster your " + weapon + "and stay in your room. Are you sure you want to do this though?");
- JOptionPane.showMessageDialog(null, "You got bored and stayed in your room all day. what a boring person you are.");
- System.exit(0);
- break;
- default:
- JOptionPane.showMessageDialog(null, "You grow restless and fidgety because you are SUPER curious about the noise. You head outside forgetting your " + weapon + "....");
- JOptionPane.showMessageDialog(null, "You were careless, the noise turned out to be a monster lurking in the shadows and killed you instantly.");
- System.exit(0);
- }
- System.exit(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement