2016-03-26 00:47:20 +01:00
|
|
|
# Turn
|
|
|
|
|
2016-07-07 00:19:43 +02:00
|
|
|
Turn the sprite as much as you say in the direction you say.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-07-18 23:23:05 +02:00
|
|
|
```sig
|
|
|
|
let item: game.LedSprite = null;
|
|
|
|
item.turn(Direction.Right, 45);
|
|
|
|
```
|
|
|
|
|
2016-07-07 00:19:43 +02:00
|
|
|
### Parameters
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-07-18 23:23:05 +02:00
|
|
|
* a choice whether the sprite should turn **left** or **right**
|
2017-03-16 15:57:41 +01:00
|
|
|
* a [number](/types/number) that means how much the sprite should turn.
|
2016-07-07 00:19:43 +02:00
|
|
|
This number is in **degrees**, so a straight left or right turn is 90 degrees.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-07-07 00:19:43 +02:00
|
|
|
### Example
|
|
|
|
|
|
|
|
|
|
|
|
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-26 00:47:20 +01:00
|
|
|
```
|
|
|
|
|
2016-07-07 00:19:43 +02:00
|
|
|
### See also
|
|
|
|
|
|
|
|
|
|
|
|
[move](/reference/game/move),
|
|
|
|
[create sprite](/reference/game/create-sprite)
|