Hello All, I'm a new Squeak enthusiast & at present i'm doing my University project, which involves developing an enhanced version of the racing car game shown in Squeak. I cant find enough reference material to start programming in Squeak. My application involves controllong the car using the keys in the keyboard. Any ideas ?
subroto mukherjee wrote:
Hello All, I'm a new Squeak enthusiast & at present i'm doing my University project, which involves developing an enhanced version of the racing car game shown in Squeak. I cant find enough reference material to start programming in Squeak. My application involves controllong the car using the keys in the keyboard. Any ideas ?
I did something like that in a while ago. It is broken in the 3.2 image but if you download a 3.0 or 2.8 image you may be able to get it to work :-o The 3.2 image has changed the way keyboard focus works and I have not figured out how to use that...
http://swiki.gsug.org:8080/sqfixes/1989.html
A project with the enhancement working can be found at
Karl
I think the problem is with the server. In the site it says that the file size is 290kb while after downloading through netscape the file size comes out to be 40kb, whereas through IE the download stays at 99%
Is it possible for you to mail me that project as an attachment ?
Subroto.
On Thursday 25 July 2002 05:46 am, subroto mukherjee wrote:
Hello All, I'm a new Squeak enthusiast & at present i'm doing my University project, which involves developing an enhanced version of the racing car game shown in Squeak. I cant find enough reference material to start programming in Squeak. My application involves controllong the car using the keys in the keyboard. Any ideas ?
I seem to have dealt with this at one point for someone, though I don't remember what I did. See:
http://lists.squeakfoundation.org/pipermail/squeak-dev/2001-October/004711.h... http://lists.squeakfoundation.org/pipermail/squeak-dev/2001-October/004714.h...
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 wrote:
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).
The thingy I did looks for the ASKII number of the key, it also give you the key number in the playfield key pressed player category. Having a key type would be nice though.
Karl
On Thursday 25 July 2002 11:40 am, Karl Ramberg wrote:
The thingy I did looks for the ASKII number of the key, it also give you the key number in the playfield key pressed player category.
Ah, good.
Having a key type would be nice though.
The problem that I can see is that the comparison operators in the scripting system only deal with Number types.
I suppose someone could hunt around for how to add this to SymbolList or other enumerated types, but I have no idea how this would be done.
I think another (easy to do, but less well-integrated) solution would be to have a separate key notifier object that watches the keyboard events and triggers scripts in other Morphs.
Its display could be something like:
Key Down/Up RecipientName script ---------------------------------------- <up> Down SomeMorph goUp <down> Down SomeMorph goDown a Down SomeOtherMorph aWasHit ---------------------------------------- [Add] [Delete] [Change]
On Thursday 25 July 2002 11:40 am, Karl Ramberg wrote:
The thingy I did looks for the ASKII number of the key, it also give you the key number in the playfield key pressed player category. Having a key type would be nice though.
I think that it would be possible to take your code and use a keyboard listener (perhaps the status morph itself). You could just patch ScriptInstantiation>>status: to handle the keyListen (or whatever you want to call it) status type.
That way you wouldn't have to worry about keyboard focus.
Did Scott Wallace once solve this problem for etoys?
P.S. Ned, I like your proposal .... Seems as though etoys should have a keyboard object/player as a way to get worthwhile properties and behaviors ....
Cheers,
Alan
------At 9:58 AM -0700 7/25/02, Ned Konz wrote:
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
--
On Thursday 25 July 2002 01:00 pm, Alan Kay wrote:
P.S. Ned, I like your proposal ....
Which one?
* global listener that triggers scripts
* make the ScriptInstantiationMorphs listen for all key events and test in the script (would require some representation of key events)
* make the ScriptInstantiationMorph listen for a specific key event (would require some interaction with the user when they chose to trigger the script with a key event; would require custom display of status)
Seems as though etoys should have a keyboard object/player as a way to get worthwhile properties and behaviors ....
What do you mean by "keyboard object/player"?
Hi ! I've already posted a querry before in the Squeak mailing list about the car script. I've got a project from my University where i've to make an enhanced version of the car script in Squeak. I have all the logic set up, but i don't know the keyevents to be used in making the car to be controlled by the keys in the keyboard. I want to make use of the arrow keys to control the car. Can you please throw some light in this area. I don't want to make use of the mailing list to post my querry as i get tons of replies, which confuses me more.
Subroto.
squeak-dev@lists.squeakfoundation.org