Discuss Scratch

medians
Scratcher
1000+ posts

a [point towards x( ) y( ) block

medians wrote:

medians
Scratcher
1000+ posts

a [point towards x( ) y( ) block

medians wrote:

medians wrote:

Tris_das_Einhorn
Scratcher
100+ posts

a [point towards x( ) y( ) block

Support, yes it is workaround-able but both of the workarounds are inconvenient, especially for less experienced Scratchers, and it seems like this would be a fairly straightforward (and very useful!) feature to add to an already-existing block.
DangerPuppy10
Scratcher
1000+ posts

a [point towards x( ) y( ) block

You have a backpack and can just
define point in direction to x: (x) y: (y)
point in direction (([atan v] of (((x) - (x position)) / ((y) - (y position)))) + ((180) * <(y position) > (y)>))
backpack that. I know people may not be able to understand it. Even I don't. yet. But this is the best option for now.
But yes. SUPPORT! (Makes everything 900 times easier.)
Malicondi
Scratcher
1000+ posts

a [point towards x( ) y( ) block

DangerPuppy10 wrote:

You have a backpack and can just
define point in direction to x: (x) y: (y)
point in direction (([atan v] of (((x) - (x position)) / ((y) - (y position)))) + ((180) * <(y position) > (y)>))
backpack that. I know people may not be able to understand it. Even I don't. yet. But this is the best option for now.
But yes. SUPPORT! (Makes everything 900 times easier.)
x and y are in the incorrect spots:
TOA:
atan of opposite / adjacent:
atan of (y - y pos) / (x - x pos)
just a small correction, but it won't work without it.
portalpower
Scratcher
1000+ posts

a [point towards x( ) y( ) block

Malicondi wrote:

DangerPuppy10 wrote:

You have a backpack and can just
define point in direction to x: (x) y: (y)
point in direction (([atan v] of (((x) - (x position)) / ((y) - (y position)))) + ((180) * <(y position) > (y)>))
backpack that. I know people may not be able to understand it. Even I don't. yet. But this is the best option for now.
But yes. SUPPORT! (Makes everything 900 times easier.)
x and y are in the incorrect spots:
TOA:
atan of opposite / adjacent:
atan of (y - y pos) / (x - x pos)
just a small correction, but it won't work without it.
This does not work. Scratch has a different angle system than trig, so treating them the same will make it offset by 90 degrees and in the opposite direction. Fortunately, you can solve both problems by taking the inverse and swapping the positions. Why do people post workarounds without testing them?
TheUltimateHoodie
Scratcher
1000+ posts

a [point towards x( ) y( ) block

interesting…this thread has been alive since 2013? i looked through the entire thread…
anyways, no support, there's an easy workaround
Malicondi
Scratcher
1000+ posts

a [point towards x( ) y( ) block

portalpower wrote:

This does not work. Scratch has a different angle system than trig, so treating them the same will make it offset by 90 degrees and in the opposite direction. Fortunately, you can solve both problems by taking the inverse and swapping the positions. Why do people post workarounds without testing them?
that isn't my workaround this workaround works 100% of the time:
define point towards x: (x) y: (y)
if <(y) < (y position)> then
point towards (([atan v] of (((y) - (y position)) / ((x) - (x position)))) + (180))
else
point towards ([atan v] of (((y) - (y position)) / ((x) - (x position))))
for a one line workaround you can use this:
point towards (([atan v] of (((y :: custom-arg) - (y position)) / ((x :: custom-arg) - (x position)))) + ((180) * <(y ::custom-arg) < (y position)>))
but i think it's less readable

Last edited by Malicondi (March 1, 2024 12:04:30)

alphabetlorefan2003
Scratcher
100+ posts

a [point towards x( ) y( ) block

After 11 years, this is still going and I support it because of how well this will work in some projects, definitely add it
DangerPuppy10
Scratcher
1000+ posts

a [point towards x( ) y( ) block

portalpower wrote:

Malicondi wrote:

DangerPuppy10 wrote:

You have a backpack and can just
define point in direction to x: (x) y: (y)
point in direction (([atan v] of (((x) - (x position)) / ((y) - (y position)))) + ((180) * <(y position) > (y)>))
backpack that. I know people may not be able to understand it. Even I don't. yet. But this is the best option for now.
But yes. SUPPORT! (Makes everything 900 times easier.)
x and y are in the incorrect spots:
TOA:
atan of opposite / adjacent:
atan of (y - y pos) / (x - x pos)
just a small correction, but it won't work without it.
This does not work. Scratch has a different angle system than trig, so treating them the same will make it offset by 90 degrees and in the opposite direction. Fortunately, you can solve both problems by taking the inverse and swapping the positions. Why do people post workarounds without testing them?
I tested the workaround. It worked. Guess not. my backpack has incorrect information :o
plantskym2
Scratcher
500+ posts

a [point towards x( ) y( ) block

Semi-support but more on the no support side because this could be really useful for people such as new scratchers, there are workarounds and most people know them.
medians
Scratcher
1000+ posts

a [point towards x( ) y( ) block

DangerPuppy10 wrote:

portalpower wrote:

Malicondi wrote:

DangerPuppy10 wrote:

You have a backpack and can just
define point in direction to x: (x) y: (y)
point in direction (([atan v] of (((x) - (x position)) / ((y) - (y position)))) + ((180) * <(y position) > (y)>))
backpack that. I know people may not be able to understand it. Even I don't. yet. But this is the best option for now.
But yes. SUPPORT! (Makes everything 900 times easier.)
x and y are in the incorrect spots:
TOA:
atan of opposite / adjacent:
atan of (y - y pos) / (x - x pos)
just a small correction, but it won't work without it.
This does not work. Scratch has a different angle system than trig, so treating them the same will make it offset by 90 degrees and in the opposite direction. Fortunately, you can solve both problems by taking the inverse and swapping the positions. Why do people post workarounds without testing them?
I tested the workaround. It worked. Guess not. my backpack has incorrect information :o
He meant the other guy, that one does not work properly.
Malicondi
Scratcher
1000+ posts

a [point towards x( ) y( ) block

medians wrote:

He meant the other guy, that one does not work properly.
yes yes i know i got my trig messed up this script does actually work 100% of the time though, i tested:
define point towards x: (x) y: (y)
point in direction (([atan v] of (((x) - (x position)) / ((y) - (y position)))) + ((180) * <((y) - (y position)) < (0)>))
i am ashamed of my sub-par trigonometry skills right now because of my last post
DangerPuppy10
Scratcher
1000+ posts

a [point towards x( ) y( ) block

medians wrote:

DangerPuppy10 wrote:

portalpower wrote:

Malicondi wrote:

DangerPuppy10 wrote:

You have a backpack and can just
define point in direction to x: (x) y: (y)
point in direction (([atan v] of (((x) - (x position)) / ((y) - (y position)))) + ((180) * <(y position) > (y)>))
backpack that. I know people may not be able to understand it. Even I don't. yet. But this is the best option for now.
But yes. SUPPORT! (Makes everything 900 times easier.)
x and y are in the incorrect spots:
TOA:
atan of opposite / adjacent:
atan of (y - y pos) / (x - x pos)
just a small correction, but it won't work without it.
This does not work. Scratch has a different angle system than trig, so treating them the same will make it offset by 90 degrees and in the opposite direction. Fortunately, you can solve both problems by taking the inverse and swapping the positions. Why do people post workarounds without testing them?
I tested the workaround. It worked. Guess not. my backpack has incorrect information :o
He meant the other guy, that one does not work properly.
Makes sense why he quoted Malicondi instead of just me. no offense, just wanted to say that.
I already “corrected ” the one in my backpack. now it ACTUALLY has incorrect information. Doing this feels like walking around in endless circles.
medians
Scratcher
1000+ posts

a [point towards x( ) y( ) block

medians wrote:

medians wrote:

LionCoder10
Scratcher
500+ posts

a [point towards x( ) y( ) block

support, this block is very useful and the workaround is hard (for beginner scratchers, I think I can handle it)
medians
Scratcher
1000+ posts

a [point towards x( ) y( ) block

medians wrote:

medians wrote:

medians wrote:

NotK3ndricAlt
Scratcher
1000+ posts

a [point towards x( ) y( ) block

Why do I remember this block being rejected?
MagicCoder330
Scratcher
1000+ posts

a [point towards x( ) y( ) block

No support easy workaround *proceeds to spout out a large mess of operator blocks that no new scratcher has any hope of understanding*

I think that this would help a lot, it would keep projects from being as cluttered as before and help new people use it.
MagicCoder330
Scratcher
1000+ posts

a [point towards x( ) y( ) block

NotK3ndricAlt wrote:

Why do I remember this block being rejected?
I think your thinking of the pointing towards sprite block, that was rejected

Sorry, you have to wait 60 seconds between posts.

Powered by DjangoBB