[ENH]Keyboard contoll of etoy scripts.
karl.ramberg at chello.se
Wed Aug 28 14:37:44 UTC 2002
Here is a stab at getting keyboard controll over etoy scripts.
This is usefull when you want to steer your car on the road,
fire bullet's at aliens etc. using keyboard instead of mouse.
I would like to hear from someone with greater knowledge of
the morphic environment than I whether this changeset will
introduce some problems as it adds a couple of methods to Morph.
"Change Set: etoy keystroke
Date: 28 August 2002
Author: Karl Ramberg
Adds ability for any morphs to recive keystrokes and trigger etoy scripts.
To test this:
Add a morph to your project.
Open a viewer on the morph.
Add a new script to it.
Set the trigger to keystroke.
Add a test tile to the script.
Select Basic category in the viewer flap.
Drag and drop a 'morph's keystroke' tile to
the test part of the test tile.
Now set the 'morph's hasKeyboardFocus' to true.
Press a key.
Look in the viewer keystroke tile and
notice that there is a number next to it.
This is the keystrokes ASCII number.
Change the test tile to check for conditions when the the
keystroke is equal to that number.
Then add a tile to the tests 'Yes' condition
something like 'morph forward by 5'
Now when the morph has keyboard focus and you press the key
that equals the number you put in, the morph will move forward by 5.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: etoy keystroke.5.cs.gz
Size: 3294 bytes
Desc: Unknown Document
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20020828/fbf0feb7/etoykeystroke.5.cs.obj
More information about the Squeak-dev