View Single Post
Old Jul 18th, 2006, 7:02 PM   #1
Jakeyman_I_Am
Newbie
 
Join Date: Mar 2005
Posts: 14
Rep Power: 0 Jakeyman_I_Am is on a distinguished road
ASCII value for left and right?

Well, here is the issue. I am expirenced in the world of Java now (that is how my teacher describes it..) and I have yet to work much with KeyEvent. I am trying to make a simple game involving moving a small object (a fillRect object) around on the screen. The problem is, what to I compare for in the KeyEvent method to find what directional arrown was pressed??? Note this is my KeyEvent code, now I just need the value to test for via if statement and I'll have this whole project done.. anyone??? Thanks for your time in advance...

public void keyPressed(KeyEvent event)
{
     if(event.getKeyText(event.getKeyCode()) == ?????)  //I don't know what to test for..
     {
		
     }
} //Note that I'm looking for the left, right, up and down keys here..
__________________
The elder newb.
Jakeyman_I_Am is offline   Reply With Quote