Skip to content

Assignment 2 development#2

Open
ciaranparker wants to merge 11 commits into
masterfrom
assignment-2-development
Open

Assignment 2 development#2
ciaranparker wants to merge 11 commits into
masterfrom
assignment-2-development

Conversation

@ciaranparker

Copy link
Copy Markdown
Owner

No description provided.

… player in the games class as well as some user input for movement using if else statements. I also included the pick up item function in the player class to allow the user to pick up an item and add it to inventory as well as a function to view the inventory contents and the player information.
… the room. The item is then added to the players inventory and the contents of the inventory is then displayed. The user is also required to enter appropriate inputs for player movements, requesting an appropriate input be entered if an inappropriate input is entered. I have also added break at the end of the while playing loop to prevent the content in the loop to keep looping.
…emy attack each other, dealing random damage. Player which reached 0 or less health first dies and loses. Changed the health to public setter so that can be changed in the main game code. I also put the looting of the room code into a while loop so that I could break the loop when the user picks up an item, preventing the code from repeating unless the user does not enter a correct input.
…oop. This means that while the respective code is running if there is an inapproprriate input the exception will be recognised and the error will be displayed to the user until they enter an appropriate input. I also made the boolean playing false when the user dies, so that the while playing loop ends when the user die allowing them to close the game.
…enemy are below 0 the health is not displayed. This means that the user cannot see the health if it is in the negatives.
…l as the inventory. If the user enters the appropriate input the description/inventory will be displayed. I also added an item string which varies depending on the user input while looting, this should allow the item to be used if required incase new needs from the game in the future.
…ecific parts of the code. I have also created a test class to return an error message and called this method of the class in a debug.Assert. Therefore whenever there is a certain bug the error message will appear.
…he room class includes 3 items. These items can then be initialized in the game class and displayed and added to inventory.
…r overwhelming, making it easier to read. I have also added logical or in if statements so that if a user enters a lowercase letter instead of capital it still runs. I also added the \n feature in some writeline statements so that it is not as overwhelming and easier to read in the terminal. I also added the items to the room class and defined them in the game class when the room was initialized. This will allow me to create different items for different rooms and easily reuse the items throughout the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant