From Test-Scratch-Wiki

This tur is about the block. For more information on the value this block reports, see Direction (value).


Direction
(direction)
Category Motion
Type Reporter
Introduced in 0.2

The direction block is a reporter block and a motion block. The block holds its Sprite's direction, measured in degrees. This direction value is controlled by the

Point in Direction () block.

Example Uses

As this block contains a sprite's direction, it is often used to help scripts that point sprites around.

Specifically, the block can be used to:

  • Simply sense a direction
say (join [I am pointing in direction: ](direction))
  • Check the direction of an arrow sprite
say (join (join [You need to head in the direction ](direction))[º to find the treasure.])
  • Check alignment

Here is an example use of the direction block:

when I receive [Check v]
if <(direction) = [50]> then
   set [Safe? v] to [1]

This script will check if its sprite's direction is 50.

Workaround

Main article: List of Block Workarounds

The block can be replicated by finding the direction value from the () of () sensing block:

([direction v] of (sprite v))

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.