33 lines
721 B
Markdown
Raw Normal View History

2016-03-25 16:47:20 -07:00
# Turn
2016-07-06 15:19:43 -07:00
Turn the sprite as much as you say in the direction you say.
2016-03-25 16:47:20 -07:00
2016-07-18 14:23:05 -07:00
```sig
game.createSprite(0, 2).turn(Direction.Right, 45);
2016-07-18 14:23:05 -07:00
```
## Parameters
2016-03-25 16:47:20 -07:00
* **direction**: a choice whether the sprite should turn **left** or **right**
* **degrees**: a [number](/types/number) degrees of angle that the sprite should turn.
A straight left or right turn is 90 degrees.
2016-03-25 16:47:20 -07:00
## Example
2016-07-06 15:19:43 -07:00
This program starts a sprite in the middle of the screen.
Next, the sprite turns toward the lower-right corner.
Finally, it moves two LEDs away to the corner.
```blocks
let item = game.createSprite(2, 2);
item.turn(Direction.Right, 45);
item.move(2);
2016-03-25 16:47:20 -07:00
```
## See also
2016-07-06 15:19:43 -07:00
[move](/reference/game/move),
[create sprite](/reference/game/create-sprite)