life

Get the game player’s life count.

info.life()

Your program has a life counter which you can set to record the number of lives remaining for a player in your game.

Returns

  • a number that is the current life count.

Example

Give the player a bonus of 1000 points if they reach 9 lives.

Single player

let giveBonus = true

if (info.life() > 8) {
    if (giveBonus) {
        info.changeScoreBy(1000)
        giveBonus = false
    }
}

Multiplayer

let giveBonus = true

if (info.player2.life() > 8) {
    if (giveBonus) {
        info.player2.changeScoreBy(1000)
        giveBonus = false
    }
}

See also

set life, change life by