Assignment #45 and Spooky House

Code


  /// Name: Tim Chuang
/// Period: 7
/// Program Name: Spooky House
/// File Name: SpookyHouse.java
/// Date Finished: 12/1/2015

import java.util.Scanner;

class SpookyHouse
{
      public static void main(String[] args) 
      {
          
          Scanner keyboard = new Scanner(System.in);
          
          String room1, room2, room3, room4;
        room1 = room2 = room3 = room4 = "room";
        System.out.println( "Welcome to this fun mystery, glhf." );
        System.out.println();
        System.out.println( "You wake up in an abandoned building. You have no memories of how you got there, only the indistinct image of a pink haired girl. Suddenly, you hear noises coming from a stairwell going down into the dark. Do you choose to go [downstairs] or [upstairs]? " );
        System.out.print( "> " ); 
        room1 = keyboard.nextLine();
        
        if ( room1.equals("upstairs") )
            {
                System.out.println( "The noises seemed to have stopped, but you ascend into a circular room and feel unnaturally cold chill. You freeze as you hear a high, childish voice whisper your name. Flinching, you whirl around to find the source of the sound, but nobody is in sight. Across the room, two doors lie. Do you choose the one on the [right] or [left]?" );
                System.out.print( "> " );
                room2 = keyboard.nextLine();
                    if ( room2.equals("right") )
                    {
                    System.out.println( "Upon entering the room, the chill grows stronger, almost as if claws were digging into your back. The voices grow stronger, and overlay each other, all giggling and calling your name, as if a choral of spectral children were haunting you. Unable to bear it, you struggle along, pressing your hands to your head in some vain effort to block out the voices. You spot a table, with two objects. Do you take the rusted [knife] or [flashlight]? " );
                    System.out.print("> ");
                    room3 = keyboard.nextLine();
                        if ( room3.equals("knife") )
                        {
                        System.out.println("You slip and slash your throat, unable to call out, a pink haired girl appears before you, lifts your face to hers, then whispers in your ear 'lets reset and try again' DEAD END" );
                        }
                        else if ( room3.equals("flashlight") )
                        {
                        System.out.println("You continue on until you reach a long hallway. You hear noises, and decide to keep the flashlight off. You keep on, struggling along the wall until you suddenly break out in a cold sweat. Something lies ahead. Do you [go forward] or [go back]?");
                    System.out.print( "> " );
                    room4 = keyboard.nextLine();
                        }
                        
                        if ( room4.equals("go forward") )
                        {
                        System.out.println( " You reach a room with a lit candle in the middle. The pink haired girl is there. 'Ive been waiting for you, Yuki' She smiles and rushes towards you. You look down at horror at the hatchet lodged into your shoulder. You fall backwards, vision going black. Seconds before fainting you hear her say 'Now we can be together forever <3' ");
                    }
                        
                    else if ( room4.equals("go back") )
                    {
                       System.out.println( " As you struggle back through the darkness, you hear a scraping sound coming from the direction you are going in. The further you go the louder it becomes, until the outline of the pink haired girl appears, dragging a long scythe on the floor. She looks up at you with painstricken eyes 'Why Yuki? We were going to be together forever'. Suddenly you drop to the floor, and attempt to stand up but notice that your legs have been cut in half. The girl towers over you, raises her scythe and slashes down. You lay there, gradually growing colder, and the last thing you see is the girl covering your eyes with her hand and saying ' Now we can be together forever <3' ");
                    }
                        
                    else if ( room2.equals("left") )
                    {
                    System.out.println( "You enter the room on the left, and stare into absolute darkness for a second, until you realize that you are lying on the floor and staring at the ceiling. You feel the back of your head because of a dull ache, and realize that your entire hand is covered with blood. A pink haired girl looks down at you and giggles. 'Oh well, I guess its time to restart' she says. She covers your eyes with her hands. DEAD END " );
                    
                    } 
                }
        else if ( room1.equals("downstairs") )
            {
            System.out.println( "The sounds intensify, and begin to grow restless. Something feels off about this house. A flickering light illuminates a [hallway] and to the side an open [door]. Where do you go?" );
            System.out.print( "> " );
            room2 = keyboard.nextLine();
                if ( room2.equals("hallway") )
                {
                System.out.println( "As you proceed along, the sounds continue to grow stronger. A girls voice rings out, giggling 'Yuki~where are you?' Spooked, you rush along to the end of the hallway, reaching a rusted metal door. You see sunlight on the other side. Do you [go through] or [turn back]" );
                System.out.print( "> " );
                room3 = keyboard.nextLine();
                    if ( room3.equals("go through") )
                    {
                    System.out.println( "You push open the heavy door, and step out into the sunlight. A voice rings out behind you, and you see the pink haired girl running at you with a long, bloodied hatchet. You keep running until you are far from the building. Eventually the girl is no longer in sight. Congrats, you win!" );
                    }
                    else if ( room3.equals("turn back") )
                    {
                    System.out.println( "You head back into the dark, but see a gruesome sight now that your eyes have adjusted to the dark. Mangled bodies drawn across the floor line the sides of the walls. You run in fear but trip on one of the bodies. You look up into the face of a pink haired girl, then feel a dull thud on the back of your head. Just before losing consciousness you hear her say ' Oh well, I guess it's time to restart' DEAD END " );
                    }
                }
        }
                
                
            }
    }
}

  

Picture of the output

Assignment 45