pxt-calliope/docs/reference/game.md
Peli de Halleux 74799c65ac Support for pause/resume of game rendering loop (#476)
* added pause/resume

* don't override displaymode in game engine

* avoid setting light sensing display mode
2017-08-01 08:17:53 -07:00

1.3 KiB

Game

Make games with sprites. Keep score and control gameplay.

Sprites

game.createSprite(0,0);
game.createSprite(0,0).delete();
game.createSprite(0,0).move(0);
game.createSprite(0,0).turn(Direction.Left,0);
game.createSprite(0,0).ifOnEdgeBounce();
game.createSprite(0,0).get(LedSpriteProperty.X);
game.createSprite(0,0).set(LedSpriteProperty.X, 0);
game.createSprite(0,0).change(LedSpriteProperty.X, 0);
game.createSprite(0,0).isTouching(null);
game.createSprite(0,0).isTouchingEdge();

Scoring

game.addScore(1);
game.score();
game.setScore(0);

Game control

game.startCountdown(10000);
game.gameOver();
game.pause();
game.resume();

See also

createSprite, move, turn, ifOnEdgeBounce, get, set, change, isTouching isTouchingEdge, addScore, score, setScore, startCountdown, gameOver, pause, resume