77ed2ccfb1
* update pxt.json files * Fix button event enums fixes https://github.com/microsoft/pxt-calliope/issues/206 * Fix Safari CSS Rule for iOS app fixes https://github.com/microsoft/pxt-calliope/issues/205 * aprove preffered repos should fix https://github.com/microsoft/pxt-calliope/issues/167
782 B
782 B
add Score
Add more to the current score for the game.
game.addScore(1)
Parameters
- a number that means how much to add to the score. A negative number means to subtract from the score.
Examples
This program is a simple game.
Press button A
as much as possible to increase the score.
Press B
to display the score and reset the score.
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
basic.showNumber(game.score())
game.setScore(0)
})
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
game.addScore(1)
})