Write a program using an object
Start to create your object-oriented text-based adventure game
Extend other people’s classes
Create an enemy in the room
Recap Week 3
Extending your knowledge of OOP
Finish your game
End of the course
You have successfully created a Room class, complete with a constructor, attributes, getters, and setters. Now you are going to create a class from scratch.
You task is to create a class to represent an item you might find in the game, such as a sword. I will show you how to integrate the Item class into your game in week four.
Open a new Python file.
Save it as item.py in the same location as your main.py file.
Create an Item class.
The Item class should have the following:
Attributes for the name and the description of the item
A constructor method
Getters and setters for the name and the description of the item
Any additional attributes and methods you would like to add
Don’t forget to test your Item class by importing item in main.py, creating an Item object, and then calling the methods.
You can see all of the code from week two, plus an example solution to this task, in this Trinket.
Compare your solution to my example and use the comments section to discuss any similarities or differences.