- This event has passed.
5:00 PM – Python Object Oriented Programming – Sebastian
June 27, 2023 @ 5:00 pm - 6:00 pm
Today We Did
- Continued Monster System program
- Added new menu items to get the last bit of required user input
- In case you need anything, feel free to email me at sebastian@ayclogic.com
Homework
- Name your homework however you’d like (you may submit your original copy from class), please submit by next Monday.
- Homework: Complete the following:a) At the end of our play() method in the MonsterSystem class, if the attack_selection was 1 then call magic_attack(), if it was 2 then call sword_attack()
b) magic_attack(self, monster) will get user input while showing the user the magic_attack_menu attribute, then store it in variable named selection. If selection is 1, set a variable to a random int from 5-10, if its 2 then random int 5-10, if its 3 then random int 5-15, if its 4 random int 5-8 (from 5 to the specified max value in the menu attribute).
c) Then by looking at the magic_attack_menu, you will call the receive_magic_attack() method belonging to the monster which was passed as a parameter to magic_attack(), giving receive_magic_attack the random number and the corresponding magic type (fire/water/earth/wind) as parameters.
d) Finally, add a case to see if the user gave an invalid selection (since you already checked for 1,2,3,4, we can simplify this). If so, print an error message and ‘return’ from the method