Quantcast
Channel: Latest posts on Suggestions
Viewing all articles
Browse latest Browse all 555

About Scratch :: Suggestions :: distance calculation

$
0
0
there is a workaround but it is quite tricky or means extra sprites and another variables here is the simpler one:
set [x1 v] to [0]
set [y1 v] to [0]
set [x2 v] to [10]
set [y2 v] to [10]
broadcast [calculate distance v]
in an other sprite called sprite 1:
when I receive [calculate distance v]
go to x: (x1) y: (y1)
set [distance v] to (distance to [sprite 2 v])
and in another sprite called sprite 2:
when I receive [calculate distance v]
go to x: (x2) y: (y2)
and here is the more complex but less sprites/variables
([sqrt v] of ((((0) - (10)) * ((0) - (10))) + (((0) - (10)) * ((0) - (10))))::operators)
so I support

Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>