Category:Sprites

Gets the value of a sprite’s property.

Sprites have a variety of properties listed below. This block has many uses, such as making a sprite properties match or debugging the code.

  • Size - the size of the sprite as a percentage. 100 is the full, default size.
  • Rotation - the clockwise rotation in degrees of the sprite
  • X position - the x position of the center of the sprite
  • Y position - the y position of the center of the sprite
  • Movement direction - the direction angle the sprite moves in. 0 moves the sprite forward (east) and 180 moves the sprite backward (west).
  • Tint - the tint, or color, overlayed on the sprite. The color may overlap and mix with the sprite’s existing color.

Examples

Example 1

Make the cow move forward by its size each time it is clicked.

Example 2

There is a bee hiding in a random location on the screen, but where is it? Printing the x and y positions of the sprite helps you find it faster.

Parameters

NameDescription
property The property of the sprite: size, rotation, x position, y position, movement direction, tint
sprite The sprite or sprite group whose property is being called

Found a bug in the documentation? Let us know at documentation@code.org