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.
IndexProgramming Questions & HelpPrograms › MINIGAME – (keypressed) proper diagonal!
Page Index Toggle Pages: 1
MINIGAME – (keypressed) proper diagonal?! (Read 489 times)
MINIGAME – (keypressed) proper diagonal?!
Feb 7th, 2010, 12:11pm
 
hey guys!
ive got a question.... Wink

im writing a minigame and im not sure how to do it, that the caracter goes diagonal...it doesnt work proper....so i wanted to ask if theres a way to get the thing fixed...?
i mean i can combinate the LEFT and UP for example....but it doesnt work properly....
would be great if u can help me..Smiley

THX
RaG



if(keyPressed){

if(key==’a'){
characterx=characterx-character_geschwindigkeit;
}

// operation diagonal! if(key==’q'){  //es klappt nicht: (key==’a’ || key==’w') für beide tasten gleichzeitig
//  charactery=characterx-character_geschwindigkeit;
//      characterx=charactery-character_geschwindigkeit;
//  }

if (key==’d'){
characterx=characterx+character_geschwindigkeit;
}

if(key==’s’){
charactery=charactery+character_geschwindigkeit;
}

if (key==’w'){
charactery=charactery-character_geschwindigkeit;
}
}
Re: MINIGAME – (keypressed) proper diagonal?!
Reply #1 - Feb 7th, 2010, 12:14pm
 
check these out : http://processing.org/hacks/hacks:multiplekeys

http://processing.org/discourse/yabb2/?num=1232739411
Page Index Toggle Pages: 1