From 1b15eefa5a4406e7e2216a86b963f4a8622dabb1 Mon Sep 17 00:00:00 2001 From: Ron Hale-Evans Date: Wed, 6 Jul 2016 13:31:42 -0700 Subject: [PATCH] Wrote new Game topic --- docs/reference/game/create-sprite.md | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docs/reference/game/create-sprite.md diff --git a/docs/reference/game/create-sprite.md b/docs/reference/game/create-sprite.md new file mode 100644 index 00000000..ab166a9c --- /dev/null +++ b/docs/reference/game/create-sprite.md @@ -0,0 +1,37 @@ +# Create Sprite + +Create a new LED sprite pointing to the right. + +A sprite is like a little LED creature you can tell what to do. +You can tell it to move, turn, and check whether it has bumped +into another sprite. + +```sig +game.createSprite(2, 2); +``` + +### Parameters + +* ``x``: The left-to-right place on the LED screen where the sprite will start out. +* ``y``: The top-to-bottom place on the LED screen where the sprite will start out. + +`0` and `4` mean the edges of the screen, and `2` means in the middle. + +### Example + +This program starts a sprite in the middle of the screen. +Next, the sprite turns toward the lower-right corner. +Finally, it moves two LEDs away to the corner. + +```blocks +let item = game.createSprite(2, 2); +item.turn(Direction.Right, 45); +item.move(2); +``` + +### See also + +[move](/reference/game/move), +[turn](/reference/game/turn), +[touching](/reference/game/touching) +