Package com.bdtripp.hauntedhouse.engine
Class CommandProcessor
java.lang.Object
com.bdtripp.hauntedhouse.engine.CommandProcessor
Interprets player commands and applies their effects to the game world.
The CommandProcessor translates parsed commands into actions, invokes the GameEngine to update
the game state, and returns messages describing the results of those actions.
- Author:
- Brian Tripp
-
Constructor Summary
ConstructorsConstructorDescriptionCommandProcessor(World world, GameEngine gameEngine) Creates a CommandProcessor that operates on the given game world. -
Method Summary
-
Constructor Details
-
CommandProcessor
Creates a CommandProcessor that operates on the given game world.- Parameters:
world- the game world whose state will be manipulated by commands.gameEngine- the engine that modifies the game's state
-
-
Method Details
-
processCommand
Given a command, process (that is: execute) the command.- Parameters:
command- the command to be processed.- Returns:
- a message to display
-
talk
Makes a play talk to a character- Parameters:
command- the command that was entered- Returns:
- a message to display
-
give
Makes the player give an item to a character- Parameters:
command- the command that was entered- Returns:
- a message to display
-