- This event has passed.
5:30 PM – Python OOP – Gamas
October 12 @ 5:30 pm - 6:30 pm
Today We Did
- We continued with Monster Inheritance.
- We added Water Golem and Stone Golem classes into monster_system.py
- We learned how to remove code duplication using inheritance.
Homework
- Change code inside monster_system.py so when player’s health <= 0,
- say “The player run out of health. The game is finished.”
- Also mention how many monster the player has slayed. For example, the player has killed dragon and water golem. “The player has slayed 2 monsters.” . Hint – You need to have for loop.
- exit from the game.
- Change code inside monster_system.py, so it will display monster as dead when its health <= 0. For example, instead of display “- Stone Golem – -2 health – 20 minimum damage – 50 maximum damage” , it should display “- Stone Golem is dead.”. Hint you need to change the code inside view_all_monster method.
- Make sure inside dragon.py, stone_golem.py and water_golem.py, after special behavior, it will have
print(f"The {self.species} now has {self.health} health remaining.") - Modify dragon.py and stone_golem.py so when it is attacked by sword, it will say, “dragon is immune from sword attack. No damage is done.” . If possible create a new method inside monster.py, dragon.py and stone_golem.py