pxt-calliope/docs/reference/game/get-sprite-property.md

40 lines
1.3 KiB
Markdown
Raw Normal View History

2016-07-15 01:58:08 +02:00
# Get Sprite Property
2016-07-15 20:54:22 +02:00
Find something out about a [sprite](/reference/game/create-sprite).
2016-07-15 01:58:08 +02:00
```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
2016-07-15 20:54:22 +02:00
This program makes a sprite and shows the number of its brightness on the screen.
2016-07-15 01:58:08 +02:00
```blocks
let ball = game.createSprite(0, 2);
basic.showNumber(ball.get(LedSpriteProperty.Brightness));
```
### See also
[turn](/reference/game/turn),
[brightness](/reference/led/brightness),
2016-07-15 19:24:16 +02:00
[change sprite property](/reference/game/change-sprite-property),
[set sprite property](/reference/game/set-sprite-property)