Discuss Scratch
- Discussion Forums
- » Suggestions
- » a [point towards x( ) y( ) block
- medians
-
1000+ posts
a [point towards x( ) y( ) block
when green flag clicked
when green flag clicked[quote][quote][quote][/quote][/quote][/quote]
Please don’t block spam.turn cw () degrees
when green flag clicked[quote][quote][quote][quote][quote][/quote][/quote][/quote][/quote][/quote]
point towards x: () y: () ::motionWorkaround:
define point towards x: (x) y: (y)now, make a blank sprite without changing the costume
set [xPos v] to (x)
set [yPos v] to (y)
broadcast [moveSprite v]
point towards [blankSprite v]when I receive [moveSprite v] //put in the blank sprite
go to x: (xPos) y: (yPos)
- medians
-
1000+ posts
a [point towards x( ) y( ) block
when green flag clicked
set [page v] to [front]
when green flag clicked
forever
if <(page) = [front]> then
set [page v] to [1]
end
end
- mumu245
-
1000+ posts
a [point towards x( ) y( ) block
Support. The posts in my dupe:
I suggest a block that points the sprite towards a position on the stage.point towards x: () y: () ::motionI know of the workaround involving blank sprites, but it's too messy. Also, sometimes you need to use dynamic positions.
I also know of the other workaround, but it's very complex and just because there is a workaround, it dosen't mean it should not be added.
I reckon there's just not much need for it. And yes, the workarounds are sometimes annoying, but it's not very hard to make a blank sprite, set it up to go to a position and then have the original sprite point towards the second one. Even if there is a specific case, you could make a custom block:define go to (x) (y)
Fine but I think it's much needed. I reckon there's just not much need for it. And yes, the workarounds are sometimes annoying, but it's not very hard to make a blank sprite, set it up to go to a position and then have the original sprite point towards the second one. Even if there is a specific case, you could make a custom block:define go to (x) (y)
Sorry, no support. I know that it's not always right to not support a suggestion because there is a workaround, this this one can be easily implemented:define point towards x: (x) y: (y)
point in direction (([atan v] of (((x) - (x position)) / ((y) - (y position)))) + (<(y position) > (y)> * (180)))
And it's a compilcated math formula. Sorry, no support. I know that it's not always right to not support a suggestion because there is a workaround, this this one can be easily implemented:define point towards x: (x) y: (y)
point in direction (([atan v] of (((x) - (x position)) / ((y) - (y position)))) + (<(y position) > (y)> * (180)))
http://scratch.mit.edu.ezproxyberklee.flo.org/discuss/topic/8101But
- dave-alt-4
-
1000+ posts
a [point towards x( ) y( ) block
bruh why are people saying no support cuz workaround , not everyone knows trigometry and using a hidden sprite would have a 0.06 sec delay
anyways , support as not everyone knows trigometry , using a hidden sprite would have a 0.06 sec delay and would make it laggier for big projects and potato devices , sometimes clones hit the 300 limit also.
anyways , support as not everyone knows trigometry , using a hidden sprite would have a 0.06 sec delay and would make it laggier for big projects and potato devices , sometimes clones hit the 300 limit also.
- medians
-
1000+ posts
a [point towards x( ) y( ) block
bruh why are people saying no support cuz workaround , not everyone knows trigometry and using a hidden sprite would have a 0.06 sec delayIf it's a potato device, it most likely won't run due to lack of ram, and most likely will just show a blue screen. YOU DON'T NEED CLONES, it goes to the coordinate so you don't generate clones. 0.06 sec delay isn't a lot and you can get used to it really easily.
anyways , support as not everyone knows trigometry , using a hidden sprite would have a 0.06 sec delay and would make it laggier for big projects and potato devices , sometimes clones hit the 300 limit also.
- SomeoneOnThelnternet
-
1000+ posts
a [point towards x( ) y( ) block
Workaround:
Then on the other sprite:
So, no support.
define point towards (x) (y)
set [pointx v] to (x)
set [pointy v] to (y)
broadcast [point v]
point towards [Sprite v]
Then on the other sprite:
when I receive [point v]
go to x: (pointx) y: (pointy)
So, no support.
Last edited by SomeoneOnThelnternet (Jan. 27, 2022 16:47:38)
- AwezomeXD
-
100+ posts
a [point towards x( ) y( ) block
If you read the posts above you, you'd realize that that solution would cause some minor lag in projects (which by itself isn't alot, but for complex projects lag can really add up) Workaround:define point towards (x) (y)
set [pointx v] to (x)
set [pointy v] to (y)
broadcast [point v]
point towards [Sprite v]
Then on the other sprite:when I receive [point v]
go to x: (pointx) y: (pointy)
So, no support.
- Michael10167
-
17 posts
a [point towards x( ) y( ) block
You can just have a sprite go to a curtain coordinate, and have another sprite point to that. You can also have it when you want that sprite to sometimes point to something else, you can have a block that is like this:
go to x: (0) y: (0)
point towards [Sprite2 v]
point in direction ([Direction v] of [Sprite1 v])
Last edited by Michael10167 (April 5, 2022 21:46:49)
- historical_supa
-
1000+ posts
a [point towards x( ) y( ) block
Would be useful since the workaround needs like a million sprites.
- k0d3rrr
-
1000+ posts
a [point towards x( ) y( ) block
Or to simplify that workaround, two sprites and two scripts. Would be useful since the workaround needs like a million sprites.
Sprite1:
when gf clickedSprite2:
go to x: (X) y: (Y)
when gf clickedBut this is still a great idea. I'm not saying this idea is bad, nor am I saying “no support”, but I'm saying the current workaround is the one provided above.
forever
point towards [Sprite1 v]
end
- CYTOTOXIC_1
-
100+ posts
a [point towards x( ) y( ) block
Support!!!!!!!!!!
the workaround is complicated, scratch is supposed to be a beginners website where people can learn the basics of code, not where you need to be some genius with trigonometry.
the workaround is complicated, scratch is supposed to be a beginners website where people can learn the basics of code, not where you need to be some genius with trigonometry.
- CYTOTOXIC_1
-
100+ posts
a [point towards x( ) y( ) block
you call that easy? for people who are new that's just not really feasible, you can make entire projects with half the code No support. Easily workaroundable.define point towards coordinates x: (x) y: (Y)See?
if <((Y) - (y position)) = [0]> then
if <(x) < (x position)> then
point in direction (-90 v)
else
point in direction (90 v)
end
else
if <((Y) - (y position)) > [0]> then
point in direction ([atan v] of (((x) - (x position)) / ((Y) - (y position))))
else
point in direction (([atan v] of (((x) - (x position)) / ((Y) - (y position)))) - (180))
end
end
- -An_Unnamed_User-
-
43 posts
a [point towards x( ) y( ) block
25% support. There's a workaround:
when green flag clickedPut this on Sprite1.
broadcast [point towards v]
point towards [Sprite 2 v] :: motion
when I receive [point towards v]Put this on Sprite2.
go to x: () y: () :: motion
Last edited by -An_Unnamed_User- (Aug. 18, 2022 09:03:35)
- gdfsgdfsgdfg
-
1000+ posts
a [point towards x( ) y( ) block
Guys, stop saying no support just because of a stupid trigonometry workaround!
if people don’t know trigonometry then its hard now go Read my post and Others peoples post!
anyways no support because of ambiguity
if people don’t know trigonometry then its hard now go Read my post and Others peoples post!
anyways no support because of ambiguity
Last edited by gdfsgdfsgdfg (Feb. 12, 2023 14:02:19)
- medians
-
1000+ posts
a [point towards x( ) y( ) block

Well, if you know trig it logically makes sense. Guys, stop saying no support just because of a stupid trigonometry workaround!
if people don’t know trigonometry then its hard now go Read my post and Others peoples post!
Though there's another workaround that makes more sense if you don't:


(30, 45):

You have to run it twice to make sure it works:

Last edited by medians (Feb. 12, 2023 14:07:41)
- gdfsgdfsgdfg
-
1000+ posts
a [point towards x( ) y( ) block
-Quote so big that I had to cut it- Guys, stop saying no support just because of a stupid trigonometry workaround!
if people don’t know trigonometry then its hard now go Read my post and Others peoples post!
I already saw that workaround
this is not practical too because it’s going to be infinite sprites on a very big project just for something
Last edited by gdfsgdfsgdfg (Feb. 12, 2023 14:09:28)
- medians
-
1000+ posts
a [point towards x( ) y( ) block
…It's one sprite. I already saw that workaround
this is not practical too because it’s going to be infinite sprites on a very big project just for something
- gdfsgdfsgdfg
-
1000+ posts
a [point towards x( ) y( ) block
…It's one sprite. I already saw that workaround
this is not practical too because it’s going to be infinite sprites on a very big project just for something
yes but you use the second sprite for the main one
which can clutter the sprites area
- medians
-
1000+ posts
a [point towards x( ) y( ) block
Uhm, what?…It's one sprite. I already saw that workaround
this is not practical too because it’s going to be infinite sprites on a very big project just for something
yes but you use the second sprite for the main one
which can clutter the sprites area
Let me guess, this is something to do with everything being made 1000x huge?
Also bringing this up