pxt-calliope/docs/reference/game/set-life.md
2018-11-01 22:22:54 -07:00

557 B

set Life

Set the game life count to this amount.

game.setLife(0)

Your program has a life counter which you can set to record the number of lives remaining for a player in your game. If you set the life count to 0 or less, the game ends.

Parameters

  • value: a number to set the life count to.

Example #example

Set the player life count to 9 lives before starting the game.

game.setLife(9)

See also #seealso

add life, remove life