- This event has passed.
5 PM – Python Object Oriented Programming – Shawn
July 14, 2023 @ 5:00 pm - 6:00 pm
Today We Did
- Finished and reviewed Supermarket Application
- Learned what inheritance is.
- Started the
MonsterInheritance
project. Created ourMonster
class,Dragon
, andTroll
.
Homework
- Copy pages 168 to 170 in your textbook into a file named
Jul14_InheritanceHW.py
- Create a file in your project called
WaterGolem.py
.- Create a class called
WaterGolem
that inherits fromMonster
- Use
super()
to call the constructor, creating aMonster
that hasWater Golem
as its species, and pass in health and max attack as parameters. - Override the
receive_magic_attack
function.- The Water Golem is immune to
fire
attack - If the magic type is water, the damage is halved
- Otherwise, the attack is done normally, as done in
Monster
- The Water Golem is immune to
- Create a class called
Feel free to let me know if you have any questions — reach me at szhuang@ayclogic.com.