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

Re: LOGO-L> Computer games



At 9:44 PM +0000 5/26/98, Robyn Valentine wrote:
>Dear Logo users,
>I know I have seen what I want somewhere but can't remember where, so I
>wonder if someone could tell me how to program so that the keys on the
>keyboard act as buttons.  I am making computer games in MicroWorlds, and
>instead of placing a button on the screen "rt 90" for instance I would
>like to be able to use a key to do the same thing.  I would appreciate
>any input.
>
>Robyn Valentine.
>---------------------------------------------------------------

Here's one way using the arrow keys. Turtle T1 is programmed to go FD 1
many times.  This process is activated by the line T1, CLICKON in GO.

to go
t1, clickon
forever [direct readchar]
end

to direct :key
if (ascii :key) = 28 [ seth 270]
if (ascii :key) = 29 [ seth 90]
if (ascii :key) = 30 [ seth 0]
if (ascii :key) = 31 [ seth 180]
if :key = "s [stopall]
end

The numbers 28 - 31 are for Macintosh.  The equivalent magic numbers for
PCs are
37 - 40.

-Michael

--------------------------------------------------------
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