- This event has passed.
5 PM – Intro To Java – Gamas
May 7, 2022 @ 5:00 pm - 6:00 pm
Today We Do
- We continued with magic attack and how to rely on inheritance to have custom behavior for Dragon.
- We learned how to call parent’s method from the children class. For example, how to call monster.doDamage(int amount) from dragon class by using super.doDamage(amount).
Homework
- Create WaterGolem.java which inherits from Monster.java
- Override doMagicDamage(String magicAttackType, int amount) and add special behavior:
- a. if magicAttackType is fire, print Water Golem is immune to fire magic attack. No damage is done.
- b. if magicAttackType is water, print Water Golem is resistant to water magic attack. Damage is halved.
- c. if magicAttackType is wind, print Wind is super effective against Water Golem. Damage is doubled.
- everything else just do regular damage.
- Download Android Studio from here: https://developer.android.com/studio