Class Lives
java.lang.Object
core.Lives
Implementation of the Lives feature.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
alive()
Returns if the current number of lives is above 0.void
changeCurrent
(int x) Changes the number of remaining lives by x.int
Returns the current number of lives.int
getMax()
Returns the max number of lives.void
Resets the current number of lives to the max value.void
setMax
(int numMax) Changes the max value of lives.toString()
Returns a formatted string containing current lives.
-
Constructor Details
-
Lives
public Lives(int x) Standard constructor.- Parameters:
x
- number of starting lives.
-
-
Method Details
-
getMax
public int getMax()Returns the max number of lives. -
getCurrent
public int getCurrent()Returns the current number of lives. -
changeCurrent
public void changeCurrent(int x) Changes the number of remaining lives by x.- Parameters:
x
- value added to current lives.
-
resetCurrent
public void resetCurrent()Resets the current number of lives to the max value. -
setMax
public void setMax(int numMax) Changes the max value of lives.- Parameters:
numMax
- new max number of lives.
-
alive
public boolean alive()Returns if the current number of lives is above 0. -
toString
-