- This event has passed.
6:30 PM – Intro To Java – Darin
August 10 @ 6:30 pm - 7:30 pm
What We Did Today:
- Continued the monster inheritance program, highlighting how to use inheritance on a class using the “extends” keyword.
- Created the magic attack method as well as made the player receive damage every time the player attacks the monster in any way.
Homework:
- Continue in your monster inheritance project and upload the files to the google drive when you are finished!
HW Finish the if statement chains for water magic, earth magic, and wind magic. Add an additional else statement to check if the input is invalid. Make a new Slime class to inherit from Monster, but make it so that the slime is immune to water type magic.
You can cross check your results with the following sample output:
MAGIC ATTACK
What type of magic do you want to use on Slime?
1. Fire magic – 10 damage
2. Water magic – 10 damage
3. Earth magic – 12 damage
4. Wind magic – 8 damage
Enter your selection: 2The slime is immune to water magic. No damage is done.
Slime attacked you and did 9 damage. You have 91 health remaining.darin has 91 health remaining.
– Troll: 100 health – (15 – 20 attack)
– Goblin: 50 health – (10 – 15 attack)
– Slime: 40 health – (5 – 10 attack)
Notes:
You can email me at ddjapri@ayclogic.com if you have any questions!