point towards any x y coordinates (atan2)

by viberfoner
See Code Download Embed
Update: turns out you can accomplish this by just doing point towards list (x, y)

credits to Zro716 on the Scratch forum for the workaround
https://scratch.mit.edu/discuss/topic/147922/?page=1#post-1374822

Drag the nodes to adjust the midpoint. The turtle sprite can also be dragged and will constantly point towards the midpoint.

In Snap, it is straightforward to have an object point to another object. But what if we want to point towards a specific point that isn't represented by a sprite (i.e. a point that is the result of an equation)?

That's where atan2 comes in handy. It finds the angle to a given point in the plane. Atan2 is common in various programming languages, and is useful for a lot of things in addition to what you see here.

Created October 29, 2019

Last updated November 30, 2019

Shared November 4, 2019