pxt-calliope/docs/reference/game/get.md
Juri Wolf 5f7a8e5301
Updates for V4 (#197)
* update yotta defaults for 16kb devices

* refactor deprecated blocks

* updates for button events

* update button events

* update refference

* update docs

* update docs

* update button event blocks

* update docs

* update block id
2022-08-10 09:36:19 -07:00

1.2 KiB

get (Sprite Property)

Get a value for a sprite property.

game.createSprite(0,0).get(LedSpriteProperty.X);

Parameters

  • property: the property of the Sprite you want to know about, like:
  • x - the horizontal location to set the sprite at on the LED screen (0-4)
  • y - the vertical location to set the sprite at on the LED screen (0-4)
  • direction - the direction in degrees for the sprite to go when the next move happens. The degree range is from -180 to 180.
  • brightness - how bright the LED sprite is. Completely dark is 0 and very bright is 255.
  • blink - how fast the sprite is will blink on and off. The blink rate is in milliseconds.

Returns

  • a number value of the property you asked for.

Example

This program makes a sprite and shows the number of its brightness on the screen.

let ball = game.createSprite(0, 2);
basic.showNumber(ball.get(LedSpriteProperty.Brightness));

See also

turn, brightness, change sprite property, set sprite property