pxt-calliope/docs/reference/game/turn.md
Galen Nickel 3f106307ff
Fix some titles, sigs in ref docs (#2128)
* Fix some title and sigs in ref docs

* better buffer source
2019-06-05 16:28:56 -07:00

721 B

Turn

Turn the sprite as much as you say in the direction you say.

game.createSprite(0, 2).turn(Direction.Right, 45);

Parameters

  • direction: a choice whether the sprite should turn left or right
  • degrees: a number degrees of angle that the sprite should turn. A straight left or right turn is 90 degrees.

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.

let item = game.createSprite(2, 2);
item.turn(Direction.Right, 45);
item.move(2);

See also

move, create sprite