Checkpoint: the player lifecycle
Challenge on lesson: Checkpoint: the player lifecycle
CHALLENGE
Difficulty: advanced+25 XP
Implement Player: constructor takes starting HP (position starts at 0). move(steps) advances position (works at any HP). hit(dmg) reduces HP but **never below 0**, and does nothing when HP is already 0. heal(amount) raises HP but does nothing when HP is 0 (the player is out). getHp() and getX() report state.
Press Submit to check your solution.
Back to lesson: Checkpoint: the player lifecycle