Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
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
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:31 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC