set Game Over Scoring Type
Set the scoring type to decide the best game score for multiple games.
game.setGameOverScoringType(game.ScoringType.HighScore)
When mulitple games are played with your game program, you can set the method to record the best game score. You can use the highest score, lowest score, or no score as the best game score.
Parameters
- type: the type of score used to record the best game score for multiple games:
highest
: use the highest score as the best game score.lowest
: use the lowest score as the best game score.none
: don’t record any score as the best score.
Example
Set the best score type to lowest
. Move the player sprite up or down to avoid the projectiles. If your player is hit by projectiles, your score is increased. The lowest score is recorded for all of the games you play.
info.onCountdownEnd(function () {
game.gameOver(true)
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Projectile, function (sprite, otherSprite) {
info.changeScoreBy(1)
})
let projectile: Sprite = null
game.setGameOverScoringType(game.ScoringType.LowScore)
let mySprite = sprites.create(img`
. . . . . . . . . . b 5 b . . .
. . . . . . . . . b 5 b . . . .
. . . . . . . . . b c . . . . .
. . . . . . b b b b b b . . . .
. . . . . b b 5 5 5 5 5 b . . .
. . . . b b 5 d 1 f 5 5 d f . .
. . . . b 5 5 1 f f 5 d 4 c . .
. . . . b 5 5 d f b d d 4 4 . .
b d d d b b d 5 5 5 4 4 4 4 4 b
b b d 5 5 5 b 5 5 4 4 4 4 4 b .
b d c 5 5 5 5 d 5 5 5 5 5 b . .
c d d c d 5 5 b 5 5 5 5 5 5 b .
c b d d c c b 5 5 5 5 5 5 5 b .
. c d d d d d d 5 5 5 5 5 d b .
. . c b d d d d d 5 5 5 b b . .
. . . c c c c c c c c b b . . .
`, SpriteKind.Player)
mySprite.left = 10
controller.moveSprite(mySprite, 0, 100)
info.startCountdown(10)
game.onUpdateInterval(500, function () {
projectile = sprites.createProjectileFromSide(img`
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . 2 2 . . . . . . .
. . . . . . 3 1 1 3 . . . . . .
. . . . . 2 1 1 1 1 2 . . . . .
. . . . . 2 1 1 1 1 2 . . . . .
. . . . . . 3 1 1 3 . . . . . .
. . . . . . . 2 2 . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
`, -60, randint(-30, 30))
})
See also
set game over effect, set game over playable, set game over message