This site requires JavaScript, please enable it in your browser!
Greenfoot back
Guihen
Guihen wrote ...

2011/7/4

Problem with getting key from keybord...

Guihen Guihen

2011/7/4

#
I'm doing a minigame that while the shift key is pressed down the image of an actor is changed... I tried to use the "isKeyDown()" function, but it don't get the shift key. Could someone help me?
mjrb4 mjrb4

2011/7/4

#
As far as I can see the shift key isn't currently mapped to anything with Greenfoot and therefore won't work with isKeyDown(). The simplest solution would simply be to use another key - is there any reason why you want to use the shift key in particular?
Guihen Guihen

2011/7/4

#
well, I'm doing something like "organ hero", so, for each musical note I have one key in the keyboard. For example, the G note (Sol) will be the "m" key; When come G# note, the key must be the "M" key, and, while the shift key is pressed down, my "note sphere" (local where the key must be pressed) whill change color. * The game whithout shift key down. img1 * The game when the shift key pressed down. Img2 I tried to do this whith java Key Listener, but it seems so hard to me now...
danpost danpost

2011/7/4

#
I was just searching out basically the same thing. I was hoping to be able to check the status of Shift (or Ctrl or Alt) while a key (a Function key, in my case) was pressed. It would have been nice to use the same function key for small steps (without the extra key) and large steps (with the extra key). :+(
Locomotion15 Locomotion15

2011/7/4

#
This is what the greenfoot api says it supports: -"a", "b", .., "z" (alphabetical keys), "0".."9" (digits), most punctuation marks. getKey() also returns uppercase characters when appropriate. -"up", "down", "left", "right" (the cursor keys) -"enter", "space", "tab", "escape", "backspace" -"F1", "F2", .., "F12" (the function keys) http://www.greenfoot.org/doc/javadoc/greenfoot/Greenfoot.html
Guihen Guihen

2011/7/4

#
I see... then, I can't get the 'shift' key? Someone have an "hard brute code" that solve my problem, anyway? =/
mjrb4 mjrb4

2011/7/5

#
I was just searching out basically the same thing. I was hoping to be able to check the status of Shift (or Ctrl or Alt) while a key (a Function key, in my case) was pressed. It would have been nice to use the same function key for small steps (without the extra key) and large steps (with the extra key). :+(
As above, the function keys are mapped and can be checked with "F1" through to "F12". As said already it's probably best to just use another key rather than trying to fudge the shift key - you could use, space, a punctuation character (full stop, single apostrophe?) or one of the arrow keys perhaps?
mjrb4 mjrb4

2011/7/6

#
After looking at whether it'd be worth adding shift to Greenfoot's recognised keys (and talking about it with Davin) it seemed to be a trivial change, so I've added support for shift and control keys to the codebase. All going well (i.e. if a problem isn't found with it in the meantime!) this should appear in some future release.
Guihen Guihen

2011/7/19

#
OOoooww, It will be very goot to mee hehe, soon I up my 'game' Thx mjrb4!
You need to login to post a reply.