Discuss Scratch
- Discussion Forums
- » Suggestions
- » a [point towards x( ) y( ) block
- Eagerexplorer2
-
8 posts
a [point towards x( ) y( ) block
I have two things to say.
1. What's the use for the block?
2.There are loopholes for it.
One use could be for when you want to point at clones, you'll use lists to track their positions. So it could be:
point towards x: ( item 1 of x positions ) y: ( item 1 of y positions )
Also, the “loopholes” sometimes add lag to the project because more sprites add more lag.
Last edited by Eagerexplorer2 (April 21, 2024 20:02:30)
- TheUltimateHoodie
-
1000+ posts
a [point towards x( ) y( ) block
No, more active scripts create more lag.I have two things to say.
1. What's the use for the block?
2.There are loopholes for it.
One use could be for when you want to point at clones, you'll use lists to track their positions. So it could be:
point towards x: ( item 1 of x positions ) y: ( item 1 of y positions )
Also, the “loopholes” sometimes add lag to the project because more sprites add more lag.
- Qo3s
-
13 posts
a [point towards x( ) y( ) block
if you are having it do it over 1000 times a second that brings the fps down to around 3.You can always move another sprite to that location and then point towards that sprite. That's what I used to do.You're absolutely right, it is possible to program it yourself, but if you don't know trig, or you are new to scratch, it would be very hard.I mean that it is possible to program it yourself.What do you mean? No support. Workaroundable. Look them up.
- TheUltimateHoodie
-
1000+ posts
a [point towards x( ) y( ) block
except scratch only allows you to do it 30 times per second maxif you are having it do it over 1000 times a second that brings the fps down to around 3.You can always move another sprite to that location and then point towards that sprite. That's what I used to do.You're absolutely right, it is possible to program it yourself, but if you don't know trig, or you are new to scratch, it would be very hard.I mean that it is possible to program it yourself.What do you mean? No support. Workaroundable. Look them up.
- TheCreatorOfUnTV
-
1000+ posts
a [point towards x( ) y( ) block
define point to (x) (y)You can thank me later.
point in direction ([atan v] of (((x) - (x position)) / ((y) - (y position)))
if <(y position) > ((y) - (y position))> then
turn ccw (180) degrees
end
Last edited by TheCreatorOfUnTV (Aug. 10, 2024 16:07:45)
- ThisIsTemp1
-
1000+ posts
a [point towards x( ) y( ) block
define point to (x) (y)You can thank me later.
point in direction ([atan v] of (((x) - (x position)) / ((y) - (y position))))
That's too complex for beginners.
- SpyCoderTest
-
57 posts
a [point towards x( ) y( ) block
Support! This makes it easy for beginners.
While yes, you can use multiple sprites, it takes an extra frame to do, which can cause problems with certain projects.
Along with this, trying to have multiple clones point at different locations simultaneously would break the non-trig workaround.
The trig workaround is just too complex for average users.
While yes, you can use multiple sprites, it takes an extra frame to do, which can cause problems with certain projects.
Along with this, trying to have multiple clones point at different locations simultaneously would break the non-trig workaround.
The trig workaround is just too complex for average users.
- CrazyCoder1247
-
100+ posts
a [point towards x( ) y( ) block
HEAVY support because this would be so convenient
- MillionOfficial
-
500+ posts
a [point towards x( ) y( ) block
Simpler: make a new sprite with empty costume and use code: You can use trigonometry to replicate this: so if I want to point toward x:40 y:60Sorry if that's a bit off.point in direction (([atan] of ((((60) - (y position)) / ((40) - (x position))))) - (90))
point towards [sprite with empty costume v]
- endyourenite
-
100+ posts
a [point towards x( ) y( ) block
Simpler Is not a word, did you mean The Simple Route or The simple waySimpler: make a new sprite with empty costume and use code: You can use trigonometry to replicate this: so if I want to point toward x:40 y:60Sorry if that's a bit off.point in direction (([atan] of ((((60) - (y position)) / ((40) - (x position))))) - (90))point towards [sprite with empty costume v]
- XxdartmonkexX
-
11 posts
a [point towards x( ) y( ) block
my guy… this is not java Here's the general script for it:This code should work for all four quadrants. I can't go full nerd and explain the advanced properties trigonometry, but hopefully wikipedia can do that for you.myX = x position
myY = y position
targetX = x position of target
targetY = y postion of target
if myY = targetY
{
if myX > targetX //if our Y positions are the same, I'll face either straight left or right
{
direction = -90
}
else
{
direction = 90
}
}
else
{
direction = atan((myX - targetX) / (myY - targetY))
if myY > targetY //because tangent can only yield up to 180 degrees, an extra 180 is added if the target's Y position is below yours
{
direction = direction + 180
}
}
- DangerPuppy10
-
1000+ posts
a [point towards x( ) y( ) block
Imagine being such a bad post that your creator edits you out of existence.
Last edited by DangerPuppy10 (Sept. 30, 2024 18:59:08)
- Qo3s
-
13 posts
a [point towards x( ) y( ) block
unless you are doing it for multiple things in each frameexcept scratch only allows you to do it 30 times per second maxif you are having it do it over 1000 times a second that brings the fps down to around 3.You can always move another sprite to that location and then point towards that sprite. That's what I used to do.You're absolutely right, it is possible to program it yourself, but if you don't know trig, or you are new to scratch, it would be very hard.I mean that it is possible to program it yourself.What do you mean? No support. Workaroundable. Look them up.
- BigNate469
-
1000+ posts
a [point towards x( ) y( ) block
Please state why- the Scratch Team doesn't really care about how many people want or don't want a feature, they care about if it would be good for Scratch. I support this very much.
The forums are not a polling service, and Scratch is not a democracy.
As for the suggestion, the workarounds are annoyingly complicated, most 8-year-olds won't understand them, and frankly they're slower than if this was implemented. It would also be easier to write code without cluttering it with yet another custom blocks definition.
- medians
-
1000+ posts
a [point towards x( ) y( ) block
It is a word, what are you talking about? It literally just means more simple.Simpler Is not a word, did you mean The Simple Route or The simple waySimpler: make a new sprite with empty costume and use code: You can use trigonometry to replicate this: so if I want to point toward x:40 y:60Sorry if that's a bit off.point in direction (([atan] of ((((60) - (y position)) / ((40) - (x position))))) - (90))point towards [sprite with empty costume v]
- sideyard
-
100+ posts
a [point towards x( ) y( ) block
I don't think this would work. There is already the
glide () secs to x: (0) y: (0)block. I understand the need for new Scratch blocks on this website, but I wouldn't support this.
- ThisIsTemp1
-
1000+ posts
a [point towards x( ) y( ) block
I don't think this would work. There is already theglide () secs to x: (0) y: (0)block. I understand the need for new Scratch blocks on this website, but I wouldn't support this.
Glide doesn't make the sprite point towards the x and y
- Discussion Forums
- » Suggestions
-
» a [point towards x( ) y( ) block