Each entity has a health property. By default, this is set to 10.
This value is incredibly useful if you are taking advantage of the
receiveDamage() method to
subtract an entity’s health. To change an entity’s initial health, you can
simply set this value in your class’s properties like so:
If we applied this to our player now, there would be no apparent change. Multiple collisions occur when passive entities overlap, because Impact doesn’t automatically resolve their positions and push the weaker entity away. In the next section, we’ll introduce weapons, and later you can tweak this value in the monster class to get a better result. For now we can just leave it as is.