From Test-Scratch-Wiki

Translate: - English - 中文 
Point in Direction ()
2.0 Point in Direction ().png
Category Motion
Type Stack

The Point in Direction () block is a Motion block and a Stack block. The block points its sprite in the specified direction; this rotates the sprite.

There has been some confusion involving the number system due to the fact that 0 is straight up, rather than off to the right (the default direction) or off to the left (as in a protractor), and that it uses a -180 to 180 circle rather than a normal 360 degree circle. Despite complaints[1], no changes have been made.

Example Uses

If a sprite must be turned and its direction is not known, this block can be used.

Some common uses for the Point in Direction () block:

  • Flipping a sprite
when I receive [Flip v]
point in direction ((direction) + (180))
  • Choosing where a cannon points
point in direction (answer)
  • Pointing vehicles towards a destination
point in direction (wanted destination)

Workaround

Main article: List of Block Workarounds

The block can be replicated with the following code:

turn right ((wanted direction) - (direction)) degrees

See Also


References

  1. https://scratch.mit.edu/discuss/topic/9700/