We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
keyPressed (Read 165 times)
keyPressed
Jan 24th, 2009, 10:19pm
 
hi,
im doing a pong game and im almost done.. but i cant press more then one key at a time.. wich syntax should i use...

void keyPressed() {
 if(key = 'q') {
   y = max(0, y-2); }}

//so if q is pressed my pannel go up but when i press an other key it stop cause the last pressed key isnt q... AND there an other problem...the pannel is really slow...

or use it like that:

void draw() {
 if(keyPressed == true) {
   if(key = 'q') {
     y = max(0, y-2); }}
}
//If i do it like that, my pannel is no more slow and it work great but i cant push more then 1 key at a time...



I already ask this but the answer i was given was to use  a boolean arrays and keyReleased but i cant use chars (q,a,o,l) as boolean and cant change convert from boolean to int... so anyone HELP ME!

Thanks for answer,
Odin
Page Index Toggle Pages: 1