addLife method

void addLife(
  1. double life
)

increase life in the player

Implementation

void addLife(double life) {
  this.life += life;
  if (this.life > maxLife) {
    this.life = maxLife;
  }
}