pxt-calliope/olddocs/js/game-library/add-point-to-score.md
2016-06-01 21:19:16 -07:00

723 B

Add Points to Score

The game library supports simple single-player time-based games. The player will ** add points to score**.

The code below shows a simple game where the user gets to press the button A as much times as possible in 10 seconds.

input.onButtonPressed(Button.A, () => {
    game.addScore(1)
})
game.startCountdown(10000)

Score

When a player achieves a goal, you can increase the game score

  • add score points to the current score
export function addScore(points: number)
  • get the current score value
export function score() : number

Lessons

bop it | game of chance | game counter