Computer science and IT assignments Undergraduate

Ghoster hunters

All in Java, this is a java 2 class so nothing to advanced

For this assignment, students will develop a turn-based ghost hunting game with two different levels of ghosts.  The key learning objectives for this assignment are: ability to setup and use classes, understanding and using inheritance, use of overloaded constructors.

The overall game concept:  You are a ghost hunter character in a game.  You are trying to clear the ghosts from a haunted house.  As you enter each room, you encounter ghosts that you must battle in order to move on.  Once you have battled and destroyed 3 ghosts and the boss ghost, the house is cleared and it is ready for a family to move in. 

Since both ghost types share common attributes, you will setup a parent or super class for Ghost with the shared attributes.  Then you will create subclasses that differentiate the specific characteristics of the regular or boss ghost.

Both ghost types will have attributes for their name and the “damage” they inflict on a character.  The default constructor for the base or super class, will be to initialize the values to null and zero.

Class RegularGhost:  A Regular ghost has a unique attribute for “health restored” to the character once the battle is over and it has been defeated.  This value will add to the health of the ghost hunter.  This ghost class will have overloaded constructors for three types of ghosts 1) default (no parameters) is 20% chance of escape, 15% damage, and 10 health restore 2) Parameter for chance of escape and damage  3) Parameter for chance of escape, user defined damage levels, and health restore.  The parameters will be set in the constructors based on asking the user if they want the game setting on easy, medium, or hard. 

Class BossGhost:  A Boss ghost has a unique attributes for “health” and “damage taken”.  There is one overloaded constructor for this class:  health and damage inflicted are parameters based on the user difficulty setting.  The amount of damage taken will be determined by the battle method chosen by the user.  This will impact the health, so at a minimum, you will need setters and getters for the health attribute.

Class GhostHunt:  Main program

Pseudocode for Gameplay:

1)  Introduce the game to the user

2) Ask the user for a setting level (easy, medium, hard)

3) Ask the user for their character name

4) Introduce the setting

5) Ask the user the room they want to enter, each room has a different ghost (objects with unique names created from default and overloaded constructors)

6) Describe the room

7) The character encounters a regular ghost: Describe the ghost, tell user the battle has started

            – Random result based on chance of escape for ghost sucked up or escapes, or damage inflicted to character

            – Check for ghost dead or character dead

            – Ask user if they want to continue battle or run away

            – Repeat above steps until either the user runs away, or the ghost or character loses

            – If the user chooses to run away then continue

            – If the user wins, then add the “health restored” and continue

            – If character/user loses: end game

8) Repeat 5 and 6 until 3 ghosts have been defeated or the character/user loses

9) The character enters the final room and encounters a boss ghost

            – Ask the user which tool they want to use (such as:  magic spell, ectoplasm vacuum)

            – Random result whether it works or not and whether ghost inflicts damage on them or not

            – Check for boss ghost or character out of health

            – Then repeat the first step of the boss battle until one of them is out of health

            – If character/user loses: end game

            – If character wins then Congratulate the user on winning! and end your story (the family moves in, everybody is happy, etc.)

Leave a Reply

Your email address will not be published. Required fields are marked *