The car script

Ned Konz ned at bike-nomad.com
Thu Jul 25 16:58:41 UTC 2002


On Thursday 25 July 2002 09:45 am, Ned Konz wrote:

> I seem to have dealt with this at one point for someone, though I
> don't remember what I did. See:

Sorry, I wasn't thinking. Integrating keyboard response with eToy 
scripting is an interesting problem, though.

I *think* what I'd do is to add another script trigger ("key 
pressed"), and maybe also a "key released" one.

And then provide a Morph property getter for the last keyboard event, 
or maybe tests for what it was.

As in, maybe,

aMorph wasLastKeyUp: '<right>'
aMorph wasLastKeyDown: 'd'

(of course, as tests on the Player).

I'd rather not introduce another eToy data type, because it's too much 
work. However, this is probably the best way to do the job from a UI 
perspective because rather than having to type in text to specify 
keys, you could just type a key (and specify up/down as well).

Background:

You can register keyboard listeners (via addKeyboardListener:).

One could add an object that responds to handleListenEvent: and 
triggers a script.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE




More information about the Squeak-dev mailing list