pxt-common-packages
Version:
Microsoft MakeCode (PXT) common packages
50 lines (34 loc) • 997 B
Markdown
Change the player score up or down by this amount.
```sig
info.changeScoreBy(0)
```
The total score amount is increased by adding the change value when it is greater than zero (positive). If the change number is less than zero (negative), the total score is reduced by the value of the change number.
## Parameters
* **value**: a [number](/types/number) whice is the amount to change the current score by.
## Example #example
Give the player a bonus of `1000` points if they reach `9` lives.
### Single player
```blocks
let giveBonus = true
if (info.life() > 8) {
if (giveBonus) {
info.changeScoreBy(1000)
giveBonus = false
}
}
```
```blocks
let giveBonus = true
if (info.player2.life() > 8) {
if (giveBonus) {
info.player2.changeScoreBy(1000)
giveBonus = false
}
}
```
[](/reference/info/set-score),
[](/reference/info/score),
[](/reference/info/on-score)