pxt-calliope/docs/reference/game/change-sprite-property.md
Galen Nickel fa37f1fac0 Batch of fixes from the Lancaster doc review (#451)
* Local commit.

* local commit

* Doc fixes from Lancaster review.

* I don't want to change these yet.

* Trailing newlines, arrr.

* Get the 'Game' cards setup.

* Take block support off of 'show animation'.

* Add 'see also' for showArrow().
2017-07-24 13:40:36 -07:00

1.3 KiB

change Sprite Property

Change the kind of number you say for a sprite.

let item: game.LedSprite = null;
item.change(LedSpriteProperty.X, 0);

Parameters

  • the sprite you want to change
  • the kind of number you want to change for 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 function)
    • brightness, how bright the LED sprite is (this works the same way as the brightness function)
    • blink, how fast the sprite is blinking (the bigger the number is, the faster the sprite is blinking)

Example

This program makes a sprite on the left side of the screen, waits two seconds (2000 milliseconds), and then moves it to the middle of the screen.

let ball = game.createSprite(0, 2);
basic.pause(2000);
ball.change(LedSpriteProperty.X, 2);

See also

turn, brightness, get sprite property, set sprite property