pxt-calliope/docs/reference/game/set.md

38 lines
1.3 KiB
Markdown
Raw Normal View History

2016-07-15 19:24:16 +02:00
# Set Sprite Property
2017-03-16 15:57:41 +01:00
Make a [sprite](/reference/game/create-sprite) store the kind of [number](/types/number) you say.
2016-07-15 19:24:16 +02:00
```sig
let item: game.LedSprite = null;
item.set(LedSpriteProperty.X, 0);
```
## Parameters
2016-07-15 19:24:16 +02:00
* the **sprite** you want to make store the number you say
2017-03-16 15:57:41 +01:00
* the kind of [number](/types/number) you want to store in the sprite, like
2016-07-15 19:24:16 +02:00
* ``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)
## Example
2016-07-15 19:24:16 +02:00
This program makes a sprite on the left side of the screen,
waits two seconds (2000 milliseconds),
and then moves it to the right side of the screen.
```blocks
let ball = game.createSprite(0, 2);
basic.pause(2000);
ball.set(LedSpriteProperty.X, 4);
```
## See also
2016-07-15 19:24:16 +02:00
[turn](/reference/game/turn),
[brightness](/reference/led/brightness),
[change sprite property](/reference/game/change),
[get sprite property](/reference/game/get)