Sprite Lab Documentation

change  size by 
Category:Actions

Changes the property of a sprite or group of sprites by a given value.

Sprites have several properties that allow them to be changed and customized. These properties can be changed throughout a project.

  • Size - the size of the sprite by percentage. 100 is the full, default size. Any number less than 100 makes the sprite smaller, and any number larger will make the sprite bigger.
  • Rotation - the direction or rotation the sprite is facing in degrees, 0 to 359.
  • x position - the x position of the center of the sprite. To remain on the canvas, this should be a number between 0 and 400. 0 is the normal default direction.
  • y position - the y position of the center of the sprite. To remain on the canvas, this should be a number between 0 and 400. 0 is the normal default direction.
  • Movement direction - the direction the sprite travels with the move forward block. 0 is the default value and moves the sprite right (east). 180 moves the sprite left (west).
  • Hue - the shade of a color. 0 is the original color and 99 goes back to the original color. Any number in between is a different color, created by offsetting the original color by whatever value specified in the argument. (The larger the number, the more different the color is).
  • Saturation - the intensity of a color. 0 is white, and 99 is the original color. Any number in between is a lighter shade of the original color.
  • Brightness - how light or dark a color is. 0 is black (complete darkness) and 99 is the original color (complete brightness). Any number in between is a darker shade of the original color.

Using this block will add the specified value to the selected property.

Examples

Example 1

Change a sprite's size when you click it.

Example 2

Change a moving sprite's direction when you click it.

Syntax

changePropBy

Parameters

NameTypeRequired?Description
sprite

The sprite or sprite group whose property is being changed

property

size, rotation, x position, y position, movement direction, hue, saturation, or brightness

value

The value to add to the property being set

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