Haunted House Game

Item.java

1.      Create a new Java
Application project,

2.      Add a new class called Item.java,

3.      Create a String array
containing the messages to present the user after exploring an item,

4.      Create an enumeration
containing the name of each item,

5.      Create an empty constructor,

6.      Create a method that
returns a string with the corresponding message from the array.

Messages.java

1.     
Create a helper class called
Messages.java,

2.     
Declare and initialize constants to
hold messages for each item.

Room.java

1.      Add a new class to the project
called Room.java that extends the Item.java class,

2.      Import necessary
libraries,

3.      Declare constants with the
relative path to the images to be used,

4.      Declare constants with the
x-y coordinates for the images,

5.      Declare and initialize
variables,

6.      Create a constructor to
display the main window,

a.      Create a method to display
the main window,

7.      Create a method to handle
the living room,

8.      Create a method to handle
the dining room,

9.      Create a method to handle
the second floor,

10.  Create a method to handle
the master bedroom,

11.  Create an initialization
method that prompts the user to select one of the three main locations and
loops until the user decides to leave,

a.      If the user selects the
living room, call the living room method,

                                                             
i.     
Prompt the user to enter the bathroom or select the chest or
the TV,

1.      If the user decides to
explore any item, display the appropriate message,

2.      Else, advance to the
bathroom,

a.      Prompt the user to select
an item,

b.      Display the appropriate
message based on selection,

3.      Prompt the user if they
want to play again,

a.      If the user selects no,
exit the loop,

b.      Else, repeat the loop.

b.      If the user selects the
dining room, call the dining room method,

                                                             
i.     
Prompt the user to enter the kitchen or select the
candelabra,

1.      If the user decides to
explore the item, display the appropriate message,

2.      Else, advance to the
kitchen,

a.      Prompt the user to select
an item or enter the pantry,

                                                                                                                                     
i.     
If the user selects an item, display the appropriate message
based on selection,

                                                                                                                                   
ii.     
Else, advance to the pantry

                                                                                                                                 
iii.     
Prompt the user to select an item, display the appropriate
message based on selection,

c.       If the user selects the
second floor, call the second floor method,

                                                             
i.     
Display the second floor image,

                                                           
ii.     
Prompt the user to enter the master bedroom, bedroom 1 or
bedroom 2,

1.      If the user selects the
master bedroom, call the method to handle the master bedroom,

a.      Prompt the user to select
an item or enter the bathroom,

                                                                                                                                     
i.     
If the user selects an item, display the message,

                                                                                                                                   
ii.     
Else, enter the bathroom,

1.      Prompt the user select an
item,

a.      Display the appropriate message,

                                                                                                                                 
iii.     
Prompt the user if they want to play again,

1.      If the user selects no,
exit the loop,

2.      Else, repeat the loop.

2.      If the user selects
bedroom 1, prompt the user to select an item or enter the common bathroom,

a.      If the user selects an
item, display the appropriate message,

b.      Else, prompt the user to
enter bedroom 2 or select an item

                                                                                                                                     
i.     
If item selected, display message,

1.      Prompt the user if they
want to play again,

a.      If the user selects no,
exit the loop,

b.      Else, repeat the loop.

                                                                                                                                   
ii.     
Else, enter bedroom and update the current location variable,

3.      If the user selects
bedroom 2, prompt the user to select an item or enter the common bathroom,

a.      If the user selects an
item, display the appropriate message,

                                                                                                                                     
i.     
Prompt the user if they want to play again,

1.      If the user selects no,
exit the loop,

2.      Else, repeat the loop.

b.      Else, prompt the user to
enter bedroom 1 or select an item

                                                                                                                                     
i.     
If item selected, display message,

                                                                                                                                   
ii.     
Else, enter bedroom and update the current location variable,

12.  Prompt the user if they
want to play again,

a.      If the user selects no,
exit the loop,

b.      Else, repeat the loop.

HauntedHouseGameLauncher.java

1.      Create a new tester class.

2.      Import the necessary
libraries,

3.      Declare a main method,

a.      Create a new object of
type Room,

b.      Call the initialization
method of the object.

 
Powered by