package main; import gamegui.Animation; public class Unit extends Entity { int hitpoints; int maxHitpoints; public Unit(final String name, final Animation img, final int hitpoints) { super(name, img); this.hitpoints = hitpoints; this.maxHitpoints = hitpoints; } public Unit(final Unit copy) { super(copy); this.maxHitpoints = copy.maxHitpoints; this.hitpoints = this.maxHitpoints; } public int getHitpoints() { return this.hitpoints; } public void takeDamage(final int damage) { this.hitpoints -= damage; } }