« All Events
12 PM – Intro To Java – Gamas
March 19, 2022 @ 12:00 pm - 1:00 pm
Today We Do
- We started Monster Inheritance project.
- We went over how to do inheritance in Java.
Homework:
- Continue with Monster Inheritance project. Add the following feature
- Add a feature so we can keep track of the player’s health.
- Add a feature so we can attack monster using magic attack.
- Every time monster is attacked, the monster will attack the player as well. The monster attack should range from 0 to monster.maxAttack which will decrease player’s health.
Gamas has 97 health remaining.
Please select one of the following monsters:
- TROLL - health remaining: 20
- DRAGON - health remaining: 100
- WATER GOLEM - health remaining: 20
Enter your selection (Enter 'exit' to quit): dragon
What do you want to do with the water golem:
1. Magic attack
2. Melee attack
3. Arrow attack
4. Heal
Enter your selection:1
What kind of magic attack you want to do to DRAGON:
1. Fire magic - 10 damage
2. Water magic - 10 damage
3. Earth magic - 12 damage
4. Wind magic - 8 damage
Enter your selection:1
DRAGON is immune to fire magic attack. No damage is done.
DRAGON attacked Gamas and did 8 damage