Class Level
- java.lang.Object
-
- edu.cnm.deepdive.scalescroller.model.Level
-
public class Level extends Object
TheLevel
class contains game logic used in conjunction with theGameViewModel
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getHearts()
Returns the current number of lives/hearts left.Boolean
getLevelWon()
Returns true if the level has been won and false if it has been lost.Mode
getMode()
Returns the mode of the scale.int
getScore()
Returns the current score in the level.Note
getTonic()
Returns the tonic of the scale.void
setHearts(boolean heartAdded)
Increments or decrements the number of hearts left.void
setScore(int points)
Sets the score for the level by adding the new points.
-
-
-
Method Detail
-
getScore
public int getScore()
Returns the current score in the level.- Returns:
- The current score.
-
setScore
public void setScore(int points)
Sets the score for the level by adding the new points. Also sets levelWon to true if the minimum score has been reached.- Parameters:
points
- The points to be added to the current score.
-
getHearts
public int getHearts()
Returns the current number of lives/hearts left.- Returns:
- The hearts left.
-
setHearts
public void setHearts(boolean heartAdded)
Increments or decrements the number of hearts left. Also sets levelWon to false if there are no hearts left.- Parameters:
heartAdded
- True if a heart has been added, false if it has been removed.
-
getTonic
public Note getTonic()
Returns the tonic of the scale.- Returns:
- The tonic of the scale.
-
getMode
public Mode getMode()
Returns the mode of the scale.- Returns:
- The mode of the scale.
-
getLevelWon
public Boolean getLevelWon()
Returns true if the level has been won and false if it has been lost. If the level is in progress, this will return null.- Returns:
- Whether the level has been won, lost, or is in progress.
-
-