Sets the property of a sprite or group of sprites to a given value.
You can change or set a sprite’s properties. Properties control things like a sprite’s size, rotation, and position. These properties are:
- 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).
(Opens YouTube in new tab)
How To Make A Sprite (https://img.youtube.com/vi/wbTJpx3driA/0.jpg)
Examples
Example 1
When the rhino is clicked, each sprite is set to a different size.
Example 2
When the rhino is clicked, each sprite is set to a different rotation.
Syntax
setProp
Parameters
Name | Type | Required? | Description |
---|---|---|---|
sprite | The sprite or sprite group whose property is being set | ||
property | size, rotation, x position, y position, movement direction | ||
value | The value of the property being set. A number input works for all five properties, but other blocks, like math or existing sprite properties, can be used. |
Found a bug in the documentation? Let us know at support@code.org.