Discuss Scratch

medians
Scratcher
1000+ posts

a [point towards x( ) y( ) block

medians wrote:

medians wrote:

Eagerexplorer2
Scratcher
8 posts

a [point towards x( ) y( ) block

alexphan wrote:

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
Scratcher
1000+ posts

a [point towards x( ) y( ) block

Eagerexplorer2 wrote:

alexphan wrote:

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.
No, more active scripts create more lag.
Qo3s
Scratcher
13 posts

a [point towards x( ) y( ) block

DaSpudLord wrote:

So_Awsome wrote:

DaSpudLord wrote:

So_Awsome wrote:

DaSpudLord wrote:

No support. Workaroundable. Look them up.
What do you mean?
I mean that it is possible to program it yourself.
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.
You can always move another sprite to that location and then point towards that sprite. That's what I used to do.
if you are having it do it over 1000 times a second that brings the fps down to around 3.
TheUltimateHoodie
Scratcher
1000+ posts

a [point towards x( ) y( ) block

Qo3s wrote:

DaSpudLord wrote:

So_Awsome wrote:

DaSpudLord wrote:

So_Awsome wrote:

DaSpudLord wrote:

No support. Workaroundable. Look them up.
What do you mean?
I mean that it is possible to program it yourself.
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.
You can always move another sprite to that location and then point towards that sprite. That's what I used to do.
if you are having it do it over 1000 times a second that brings the fps down to around 3.
except scratch only allows you to do it 30 times per second max
TheCreatorOfUnTV
Scratcher
1000+ posts

a [point towards x( ) y( ) block

define point to (x) (y)
point in direction ([atan v] of (((x) - (x position)) / ((y) - (y position)))
if <(y position) > ((y) - (y position))> then
turn ccw (180) degrees
end
You can thank me later.

Last edited by TheCreatorOfUnTV (Aug. 10, 2024 16:07:45)

ThisIsTemp1
Scratcher
1000+ posts

a [point towards x( ) y( ) block

TheCreatorOfUnTV wrote:

define point to (x) (y)
point in direction ([atan v] of (((x) - (x position)) / ((y) - (y position))))
You can thank me later.

That's too complex for beginners.
SpyCoderTest
Scratcher
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.
CrazyCoder1247
Scratcher
100+ posts

a [point towards x( ) y( ) block

HEAVY support because this would be so convenient
MillionOfficial
Scratcher
500+ posts

a [point towards x( ) y( ) block

turkey3 wrote:

You can use trigonometry to replicate this: so if I want to point toward x:40 y:60
point in direction (([atan] of ((((60) - (y position)) / ((40) - (x position))))) - (90))
Sorry if that's a bit off.
Simpler: make a new sprite with empty costume and use code:
point towards [sprite with empty costume v]
endyourenite
Scratcher
100+ posts

a [point towards x( ) y( ) block

MillionOfficial wrote:

turkey3 wrote:

You can use trigonometry to replicate this: so if I want to point toward x:40 y:60
point in direction (([atan] of ((((60) - (y position)) / ((40) - (x position))))) - (90))
Sorry if that's a bit off.
Simpler: make a new sprite with empty costume and use code:
point towards [sprite with empty costume v]
Simpler Is not a word, did you mean The Simple Route or The simple way
XxdartmonkexX
Scratcher
11 posts

a [point towards x( ) y( ) block

ProdigyZeta7 wrote:

Here's the general script for it:
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
}
}
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.
my guy… this is not java
DangerPuppy10
Scratcher
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
Scratcher
13 posts

a [point towards x( ) y( ) block

TheUltimateHoodie wrote:

Qo3s wrote:

DaSpudLord wrote:

So_Awsome wrote:

DaSpudLord wrote:

So_Awsome wrote:

DaSpudLord wrote:

No support. Workaroundable. Look them up.
What do you mean?
I mean that it is possible to program it yourself.
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.
You can always move another sprite to that location and then point towards that sprite. That's what I used to do.
if you are having it do it over 1000 times a second that brings the fps down to around 3.
except scratch only allows you to do it 30 times per second max
unless you are doing it for multiple things in each frame
WaffleDeesGames
Scratcher
18 posts

a [point towards x( ) y( ) block

I support this very much.
BigNate469
Scratcher
1000+ posts

a [point towards x( ) y( ) block

WaffleDeesGames wrote:

I support this very much.
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.

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
Scratcher
1000+ posts

a [point towards x( ) y( ) block

endyourenite wrote:

MillionOfficial wrote:

turkey3 wrote:

You can use trigonometry to replicate this: so if I want to point toward x:40 y:60
point in direction (([atan] of ((((60) - (y position)) / ((40) - (x position))))) - (90))
Sorry if that's a bit off.
Simpler: make a new sprite with empty costume and use code:
point towards [sprite with empty costume v]
Simpler Is not a word, did you mean The Simple Route or The simple way
It is a word, what are you talking about? It literally just means more simple.
Dragon_hord
Scratcher
90 posts

a [point towards x( ) y( ) block

bump
sideyard
Scratcher
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
Scratcher
1000+ posts

a [point towards x( ) y( ) block

sideyard wrote:

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.

Glide doesn't make the sprite point towards the x and y

Powered by DjangoBB