Issue Details (XML | Word | Printable)

Key: SQ-331
Type: Feature Feature
Status: Resolved Resolved
Resolution: Complete
Priority: Optional Optional
Assignee: Unassigned
Reporter: Bert Freudenberg
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
squeakland

Better keyboard support for games

Created: 07/Sep/09 04:30 PM   Updated: 30/Sep/10 05:10 AM   Resolved: 28/Aug/10 02:11 PM
Component/s: etoys
Fix Version/s: future release

Time Tracking:
Not Specified

File Attachments: 1. File KeystrokeScriptInstatiation.1.cs (6 kB)
2. File KeystrokeScriptInstatiation.4.cs (21 kB)



 Description  « Hide
To help making interactive games I propose to add a tile to the World's viewer to check if a specific key is currently pressed or not. This would allow for far more accurate game controls than the current "last key stroke" tile, also it allows to press multiple keys at once (e.g., to move diagonally by pressing both up and right, while hammering on the space key).

Implementation-wise this would need a set of currently held down keys. To not lose very short key presses we need to make sure that a keydown/keyup pair received in the same world cycle still is registered for this one cycle.

The implementation is a bit complicated by the fact that key up/down codes differ significantly by platform and possibly by keyboard layout.

Karl Ramberg added a comment - 02/Feb/10 12:02 PM
What about having the script status be a specific key ?
Then you could trigger scrips without dealing with a ticking test script looking for different keys and maybe we could get better response time as well




Bert Freudenberg added a comment - 02/Feb/10 04:06 PM
I think for some tasks a ticking script would work better and be simpler to use, for some the triggering you describe. Wouldn't hurt to have both IMHO.

Karl Ramberg added a comment - 06/Feb/10 06:06 PM
"Change Set: KeystrokeScriptInstatiation
Date: 6 February 2010
Author: Karl Ramberg

Enables the #keyStroke script instatiation with global scope. Scripts trigger on event #keyStroke and do not need to be ticking. You still need to test for which key that was hit to differentiate different behaviour. Also the scripts do not run continously. For this to work smoother, and pick up different keystrokes simultanously deeper hacking is needed"

Karl Ramberg added a comment - 13/Feb/10 02:39 PM
"Change Set: KeystrokeScriptInstatiation
Date: 13 February 2010
Author: Karl Ramberg

Enables the #keyStroke #keyDown and #keyUp script instatiation with global scope. Scripts trigger on event #keyStroke #keyDown and #keyUp and do not need to be ticking. You still need to test for which key that was hit to differentiate different behaviour. Also the scripts do not run continously. For this to work smoother, and pick up different keystrokes simultanously deeper hacking is needed"

Bert Freudenberg added a comment - 28/Aug/10 02:11 PM
Mark for testing