Level Option – Max Lives

The optional maxLives level option defines how many lives a player should start with, which is also the maximum amount of lives the player can have even after collecting “extra heart” power-ups.

{
  "opts": {
    "maxLives": 1, 2, or 3
  }
}

Values #

options: 1, 2, 3


Example Level JSON #

maxLives = 1 #

Game ends immediately after colliding with a bomb

{
  "items": [
    {
      "type": "chunk",
      "data": {
        "0": [ {"key": "b", "gridY": 90} ]
      }
    }
  ],
  "opts": {
    "endPadding":  4,
    "repeat"    : -1,
    "maxLives"  :  1
  }
}

maxLives = 3 with hearts #

Extra hearts do not add more lives past the maximum

{
  "items": [
    {
      "type": "chunk",
      "data": {
        "0": [ {"key": "h", "gridY": 98} ]
      }
    }
  ],
  "opts": {
    "endPadding":  20,
    "repeat"    : -1,
    "maxLives"  :  3
  }
}