From 14f16f9b2cc01aee17e7e84529dfc125fcc891e2 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Thu, 8 Dec 2016 08:51:18 -0800 Subject: [PATCH] expose game.setScore in blocks fix for https://github.com/Microsoft/pxt/issues/881 --- libs/core/_locales/core-jsdoc-strings.json | 2 +- libs/core/_locales/core-strings.json | 1 + libs/core/game.ts | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/core/_locales/core-jsdoc-strings.json b/libs/core/_locales/core-jsdoc-strings.json index 7b23ac25..44b19763 100644 --- a/libs/core/_locales/core-jsdoc-strings.json +++ b/libs/core/_locales/core-jsdoc-strings.json @@ -85,7 +85,7 @@ "game.setLife": "Sets the current life value", "game.setLife|param|value": "TODO", "game.setScore": "Sets the current score value", - "game.setScore|param|value": "TODO", + "game.setScore|param|value": "new score value.", "game.showScore": "Displays the score on the screen.", "game.startCountdown": "Starts a game countdown timer", "game.startCountdown|param|ms": "countdown duration in milliseconds, eg: 10000", diff --git a/libs/core/_locales/core-strings.json b/libs/core/_locales/core-strings.json index 264fced3..080f1221 100644 --- a/libs/core/_locales/core-strings.json +++ b/libs/core/_locales/core-strings.json @@ -110,6 +110,7 @@ "game.createSprite|block": "create sprite at|x: %x|y: %y", "game.gameOver|block": "game over", "game.score|block": "score", + "game.setScore|block": "set score %points", "game.startCountdown|block": "start countdown|(ms) %duration", "game|block": "game", "images.createBigImage|block": "create big image", diff --git a/libs/core/game.ts b/libs/core/game.ts index ccd36552..f2020bde 100644 --- a/libs/core/game.ts +++ b/libs/core/game.ts @@ -146,8 +146,9 @@ namespace game { /** * Sets the current score value - * @param value TODO + * @param value new score value. */ + //% blockId=game_set_score block="set score %points" blockGap=8 //% weight=10 help=game/set-score export function setScore(value: number): void { _score = Math.max(0, value);