[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> MicroWorlds question...



Here's how I did it:

With one turtle on the screen make a many times button with the instruction
GO, and put these procedures on the procedures page.

to near? :point1 :point2
output (dist :point1 :point2) < 10
end

to go
if near? pos mousepos [announce [That tickles!!]]
end

to dist :point1 :point2
output sqrt
         sum
           sqr difference first :point2  first :point1
           sqr difference last :point2 last :point1
end

to sqr :number
output :number * :number
end


NEAR? reports true if the distance between two points is less than 10. (You
can change the number 10 to whatever you want.)

There is a DISTANCE primitive in MicroWorlds but it reports the distance
from the current turtle to another turtle specififed as its input. It's
very straightforward and useful in many cases, but here we need a more
gereral procedure, so I wrote DIST.

If there's more than one turtle on the screen you'll need to make GO more
sepcific, e.g.:

to go
if near?  ask "t2 [pos] mousepos [announce [That tickles!!]]
end

Enjoy!

-Michael



At 8:09 PM +1100 11/26/98, Jeff wrote:
>On Wed, 25 Nov 1998, Bill Kerr wrote:
>> play around with this procedure:
>> to go
>> show mousepos
>> if pos = mousepos [pr "y]
>> end
>> This does a mouseover type effect but only if the mouse co-ordinates are
>> *exactly* the same as the turtle co-ordinates, which is quite hard to
>> achieve. How do you fudge it so that it works if the mouse is *close* to the
>Bill
>set it up for a range, < x+ 5 >x-5 etc for the values reported by POS
>Jeff
>---------------------------------------------------------------
>Please post messages to the Logo forum to logo-l@gsn.org.  Mail
>questions about the list administration to logofdn@gsn.org.  To
>unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.


--------------------------------------------------------
Michael Tempel                    tel: 212 579 8028
Logo Foundation                   fax: 212 579 8013
250 West 85th Street              michaelt@media.mit.edu
New York  NY 10024
http://el.www.media.mit.edu/logo-foundation/


---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home