June 2018
Intermediate to advanced
310 pages
6h 32m
English
Back to our Soldier class. We want it to be as adaptable as possible, right? He knows he can move or use his weapon for greater good. But how exactly is he going to do that?
We totally forgot to implement those parts! Let's start with our weapons:
class Grenade : Weapon { override fun causeDamage() = GRENADE_DAMAGE}class GrenadePack : Weapon { override fun causeDamage() = GRENADE_DAMAGE * 3}class Rifle : Weapon { override fun causeDamage() = RIFLE_DAMAGE}
class MachineGun : Weapon { override fun causeDamage() = RIFLE_DAMAGE * 2}
Now, let's look at how we can move:
class RegularLegs : Legs { override fun move() = REGULAR_SPEED}class AthleticLegs : Legs { override fun move() = REGULAR_SPEED * 2}
Read now
Unlock full access