m (moved Point In Direction () (block) to Point in Direction () (block): Uncapitalizing a letter.)
 
m (updated to 3.0 sb)
 
(44 intermediate revisions by 22 users not shown)
Line 1: Line 1:
 
{{block
 
{{block
| name      = Point In Direction ()
+
| name      = Point in Direction ()
| image      = File:Point_in_Direction_()_Block.gif
+
| image      = point in direction ()
| imagewidth = 146
 
 
| category  = [[Motion Blocks|Motion]]
 
| category  = [[Motion Blocks|Motion]]
 
| type      = [[Stack Block|Stack]]
 
| type      = [[Stack Block|Stack]]
 +
| default    = 90
 +
| sb        = yes
 
}}
 
}}
The '''Point In Direction ()''' [[blocks|block]] is a [[Motion Blocks|Motion Block]] and a [[Stack Block]]. The block points its [[sprite]] to the specified value - this changes the sprite's [[direction]]. Besides inputing the wanted number, there is a small drop-down menu with the common numbers:
+
The '''Point in Direction ()''' [[Blocks|block]] is a [[Motion Blocks|Motion block]] and a [[Stack Block|Stack block]]. The block points its [[sprite]] in the specified [[Direction (value)|direction]]; this rotates the sprite.
  
[[File:Point_in_Direction_()_Drop_Down.png]]
+
The blocks use the 360 degrees in a circle. The [[Default Value]] is 90 and can be replaced by any Number (360+x displays the same than 0+x).
  
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), and that it uses a -180 to 180 circle rather than a normal 360 degree circle - but so far no changes have been made.
+
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,<ref>https://scratch.mit.edu/discuss/topic/9700/</ref> no changes have been made.
==Common Uses==
+
[[File:Showdirection.gif|150px|thumb|right|Direction dependent of value]]
*Flipping a sprite
 
[[File:Flip_script.png]]
 
*Rotating a sprite
 
[[File:Jumpy_rotation.png]]
 
*If a variable is used to decide the direction, the sprite can point towards an important goal in the project.
 
[[File:Pointing_in_a_given_direction.png]]
 
  
{{Scratch Blocks}}
+
==Example Uses==
[[Category:Blocks]]
+
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
 +
 
 +
<scratchblocks>
 +
when I receive [Flip v]
 +
point in direction ((direction) + (180))
 +
</scratchblocks>
 +
* Choosing where a cannon points
 +
 
 +
<scratchblocks>
 +
point in direction (answer)
 +
</scratchblocks>
 +
* Pointing vehicles towards a destination
 +
 
 +
<scratchblocks>
 +
point in direction (wanted destination)
 +
</scratchblocks>
 +
 
 +
==Workaround==
 +
{{main|List of Block Workarounds}}
 +
The block can be replicated with the following code:
 +
 
 +
<scratchblocks>
 +
turn right ((wanted direction) - (direction)) degrees
 +
</scratchblocks>
 +
 
 +
==See Also==
 +
* [[Point Towards () (block)|Point Towards ()]]
 +
* [[Finding Direction with Velocity]]
 +
 
 +
{{Motion Blocks}}
 +
 
 +
[[de:Setze Richtung auf () (Block)]]
 +
[[fr:Scratch Wiki Accueil/les blocs/mouvement/se diriger en faisant un angle de ( v)]]
 +
[[ru:Повернуть в направлении ()]]
 +
 
 +
==References==
 +
<references/>
 +
 
 +
[[ja:() 度に向ける (ブロック)]]
 
[[Category:Motion Blocks]]
 
[[Category:Motion Blocks]]

Latest revision as of 01:50, 4 July 2019

Point in Direction ()
point in direction ()
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.

The blocks use the 360 degrees in a circle. The Default Value is 90 and can be replaced by any Number (360+x displays the same than 0+x).

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.

Direction dependent of value

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/