Discuss Scratch

Nambaseking01
Scratcher
1000+ posts

Distance to (x) (y)

Agreed, the workaround is too long and this could be way easier for New Scratchers. This could also be useful for adventure games, to show how much pixels there is left to reach the destination.
sathvikrias
Scratcher
500+ posts

Distance to (x) (y)

support (support * a lot)

gosoccerboy5
Scratcher
1000+ posts

Distance to (x) (y)

Why not merge it with the
point towards x:() y:() :: motion
block?
rontinn
Scratcher
85 posts

Distance to (x) (y)

Support
sportfan999
Scratcher
1000+ posts

Distance to (x) (y)

Here's a simple workaround:
set [y change v] to ([abs v] of ((y position)-(desired y::grey)))
set [x change v] to ([abs v] of((x position)-(desired x::grey)))
set [distance v] to ((x change)/(y change))
It uses the good ol' y=mx+b, but because the y-intercept isn't important, we just find the slope.

rontinn wrote:

Support
Please say why. This is the discussion forums, not a ballot box.

Last edited by sportfan999 (Nov. 30, 2020 21:42:32)

portalpower
Scratcher
1000+ posts

Distance to (x) (y)

sportfan999 wrote:

Here's a simple workaround:
set [y change v] to ((y position)-(desired y::grey))
set [x change v] to ((x position)-(desired x::grey))
set [distance v] to ((x change)/(y change))
It uses the good ol' y=mx+b, but because the y-intercept isn't important, we just find the slope.

rontinn wrote:

Support
Please say why. This is the discussion forums, not a ballot box.
you forgot to add abs, it can't be a negative number
sportfan999
Scratcher
1000+ posts

Distance to (x) (y)

portalpower wrote:

sportfan999 wrote:

snip
you forgot to add abs, it can't be a negative number
True. Just a sec.
Randox
Scratcher
1 post

Distance to (x) (y)

Oh good it's just a simple Pythagorean theorem. “A^2 + B^2 = C^2” and all that… Well mostly. Still doable
wvj
Scratcher
1000+ posts

Distance to (x) (y)

Workaroundable but support because it makes things easier

BanMeOS
Scratcher
500+ posts

Distance to (x) (y)

wvj wrote:

Workaroundable but support because it makes things easier


yeah, that one is just the distance formula from math which is just sqrt((a1 - a2)^2 + (b1-b2)^2). This comes from the pythagorean theorem.
Buhron8312480
Scratcher
100+ posts

Distance to (x) (y)

Workaround
(distance to [x 6 v])
YtArie5
Scratcher
1000+ posts

Distance to (x) (y)

bump
Jackson49_test
Scratcher
100+ posts

Distance to (x) (y)

Bump
floppasyay
Scratcher
1000+ posts

Distance to (x) (y)

Bump
medians
Scratcher
1000+ posts

Distance to (x) (y)

medians wrote:

medians wrote:

medians wrote:

medians
Scratcher
1000+ posts

Distance to (x) (y)

Bringing this topic up. You could use the distance formula though.
Also, there could be as well:
distance between x: () y: () and x: () y: () ::sensing reporter
You would be able to replicate this by putting x position and y position as one of the inputs.
ThisIsTemp1
Scratcher
1000+ posts

Distance to (x) (y)

Bump.

Powered by DjangoBB