From 3ce1fa9b6e9d3aa39b9cfddd8e44c78b6cd52935 Mon Sep 17 00:00:00 2001 From: Ron Hale-Evans Date: Thu, 14 Jul 2016 16:58:08 -0700 Subject: [PATCH] New Game topic --- docs/reference/game/get-sprite-property.md | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/reference/game/get-sprite-property.md diff --git a/docs/reference/game/get-sprite-property.md b/docs/reference/game/get-sprite-property.md new file mode 100644 index 00000000..4a712b9d --- /dev/null +++ b/docs/reference/game/get-sprite-property.md @@ -0,0 +1,38 @@ +# Get Sprite Property + +Find something out about a sprite. + +```sig +let item: game.LedSprite = null; +item.get(LedSpriteProperty.X); +``` + +### Parameters + +* the **sprite** you want to know something about +* the kind of [number](/reference/types/number) you want to know about the sprite, like + * ``x``, how far up or down the sprite is on the screen (`0`-`4`) + * ``y``, how far left or right the sprite is on the screen (`0`-`4`) + * ``direction``, which way the sprite is pointing (this works the same way as the [turn](/reference/game/turn) function) + * ``brightness``, how bright the LED sprite is (this works the same way as the [brightness](/reference/led/brightness) function) + * ``blink``, how fast the sprite is blinking (the bigger the number is, the faster the sprite is blinking) + +### Returns + +The [number](/reference/types/number) you asked for. + +### Example + +This program creates a sprite and shows the number of its brightness on the screen. + +```blocks +let ball = game.createSprite(0, 2); +basic.showNumber(ball.get(LedSpriteProperty.Brightness)); +``` + +### See also + +[turn](/reference/game/turn), +[brightness](/reference/led/brightness), +[change sprite property](/reference/foo/bar-bas), +[set sprite property](/reference/foo/bar-bas)