This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-04-22 02:13:40

dinosaur1995
New Scratcher
Registered: 2013-04-18
Posts: 8

Need help!

say for instance, I have a canvas and I would like to click on 2 distinct points,
How would I code it in such a way, that when I click on a point once, it will save it, and then when I clicked on another point again, it will then show the x-y coordinate and give me the distance between the 2 given points.

Also, say for instance I would like to restrict this two points where the x-value should fall within -200 < x < 200

anybody? do I need to use list or a forever loop when presenting this?

Thank you!  smile

Offline

 

#2 2013-04-22 09:41:29

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Need help!

You can find the distance with this rather long equation:
http://wiki.scratch.mit.edu/w/images/Distance_to_x_y_Workaround.png (click for full size)

You need variables to save the locations.

Offline

 

#3 2013-04-23 05:35:16

dinosaur1995
New Scratcher
Registered: 2013-04-18
Posts: 8

Re: Need help!

but how would you save the previous click?
I would also like to restict these points within -200 <x < 200 of the canvas, so when I click outside this x-coordinate, it will come up as an error, rather than recording it as the first or second point

Offline

 

Board footer