From Test-Scratch-Wiki

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


Direction
2.0 Direction.png
Category Motion
Type Reporter

The Direction block is a Motion block and a Reporter block. The block holds its sprite's direction, measured in degrees

— this direction value is what is used with 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 simply be replicated with the following code:

([direction v] of [wanted sprite v])

See Also

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