Discuss Scratch
- Discussion Forums
- » Suggestions
- » New "point towards..." and "distance to..." Blocks
- TPS1001_Games
-
Scratcher
15 posts
New "point towards..." and "distance to..." Blocks
1.
I would like to see the second block in Scratch too.
Pros: You can point towards a coordinate position that never changes without having to make a sprite just for this.
2.
I would like to see the second block in Scratch too.
Pros: You have the distance to a coordinate position that never changes without having to make a sprite just for this.
Tell me if I can improve this blocks or this post, Feedback is highly appreciated. I just think it would be nice and useful to have this two blocks in the Scratch Editor
point towards [... v]
point towards x: () y: () :: motion
I would like to see the second block in Scratch too.
Pros: You can point towards a coordinate position that never changes without having to make a sprite just for this.
2.
(distance to [... v])
(distance to x: () y: () :: sensing)
I would like to see the second block in Scratch too.
Pros: You have the distance to a coordinate position that never changes without having to make a sprite just for this.
Tell me if I can improve this blocks or this post, Feedback is highly appreciated. I just think it would be nice and useful to have this two blocks in the Scratch Editor

- orangetheory
-
Scratcher
500+ posts
New "point towards..." and "distance to..." Blocks
1.point towards [... v]That is already added in Scratch, unless you want it to point toward something different other than the cursor or a sprite.
1.point towards x: () y: () :: motion
The work around is not too complicated and only requires a few extra moments…
how do I make this smaller? Sorry lol

1.(distance to [... v])
(distance to x: () y: () :: sensing)
That block would be an interesting suggestion, all though there are plenty of workarounds for that as well. Use the search bar - it should help you a ton.
- jvvg
-
Scratcher
1000+ posts
New "point towards..." and "distance to..." Blocks
You could accomplish the latter using a bit of math, specifically the distance formula.
It would be something like this (someone please check my work):
That being said, this is a fairly cumbersome script so this block could be useful.
It would be something like this (someone please check my work):
([sqrt v] of ((((x position) - (x)) * ((x position) - (x))) + (((y position) - (y)) * ((y position) - (y)))))
That being said, this is a fairly cumbersome script so this block could be useful.
Last edited by jvvg (Dec. 3, 2021 22:29:27)
- TPS1001_Games
-
Scratcher
15 posts
New "point towards..." and "distance to..." Blocks
I always meant the latter1.point towards [... v]That is already added in Scratch, unless you want it to point toward something different other than the cursor or a sprite.

Wow that's fantastic and it works! My math skills aren't that advanced I don't even know what atan means

I will use that in a project.
([sqrt v] of ((((x position) - (x)) * ((x position) - (x))) + (((y position) - (y)) * ((y position) - (y)))))
Thank you that reminds me of a project where I used this method.
What do you think about this? But you would have to update the distance variable each time before you use it and the positions has changed.
define set distance to x: (x) y: (y)
set [distance v] to ([sqrt v] of ((((x position) - (x)) * ((x position) - (x))) + (((y position) - (y)) * ((y position) - (y)))))
set distance to x: (0) y: (0)
say (distance :: variables)
Lol I saw the point towards x y block isn't a unique idea XD
Last edited by TPS1001_Games (Dec. 4, 2021 18:32:29)
- Discussion Forums
- » Suggestions
-
» New "point towards..." and "distance to..." Blocks