2016-04-05 22:23:42 +02:00
|
|
|
# Game
|
|
|
|
|
2017-07-24 22:40:36 +02:00
|
|
|
Make games with sprites. Keep score and control gameplay.
|
|
|
|
|
|
|
|
## Sprites
|
|
|
|
|
|
|
|
```cards
|
|
|
|
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
|
2016-04-05 22:23:42 +02:00
|
|
|
|
|
|
|
```cards
|
|
|
|
game.addScore(1);
|
|
|
|
game.score();
|
2017-07-24 22:40:36 +02:00
|
|
|
game.setScore(0);
|
|
|
|
```
|
|
|
|
|
|
|
|
## Game control
|
|
|
|
|
|
|
|
```cards
|
2016-04-05 22:23:42 +02:00
|
|
|
game.startCountdown(10000);
|
|
|
|
game.gameOver();
|
2017-08-01 17:17:53 +02:00
|
|
|
game.pause();
|
|
|
|
game.resume();
|
2016-04-05 22:23:42 +02:00
|
|
|
```
|
2016-08-08 22:08:15 +02:00
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## See also
|
2016-08-08 22:08:15 +02:00
|
|
|
|
2017-08-11 02:52:43 +02:00
|
|
|
[create sprite](/reference/game/create-sprite), [move](/reference/game/move), [turn](/reference/game/turn),
|
2017-07-24 22:40:36 +02:00
|
|
|
[ifOnEdgeBounce](/reference/game/if-on-edge-bounce), [get](/reference/game/get), [set](/reference/game/set),
|
2017-08-11 02:52:43 +02:00
|
|
|
[change](/reference/game/change), [is touching](/reference/game/is-touching) [is touching edge](/reference/game/is-touching-edge),
|
|
|
|
[add score](/reference/game/add-score), [score](/reference/game/score), [set score](/reference/game/set-score),
|
|
|
|
[start countdown](/reference/game/start-countdown), [game over](/reference/game/game-over),
|
2017-08-01 17:17:53 +02:00
|
|
|
[pause](/reference/game/pause), [resume](/reference/game/resume)
|