Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 05-10-2004, 07:31 AM   #1 (permalink)
zergmuncher
Registered User
 
zergmuncher's Avatar
 
Join Date: May 2003
Location: CA
Posts: 12
zergmuncher is on a distinguished road
Send a message via AIM to zergmuncher
game controlls?

How do I get java to read special characters (such as the left and right arrow key)? I'm a java student and my final project is a game which will use arrow keys to navigate, I can get it to read characters like "l" using the ConsoleIO class, but, you know...I'm a n00b. Thank you!

getComment()
{
return null;
}
zergmuncher is offline   Reply With Quote
Old 05-10-2004, 08:14 AM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
I'm not much of a UI expert, but how are you doing things? Swing?
__________________
GitS
Belisarius is offline   Reply With Quote
Old 05-10-2004, 09:55 PM   #3 (permalink)
zergmuncher
Registered User
 
zergmuncher's Avatar
 
Join Date: May 2003
Location: CA
Posts: 12
zergmuncher is on a distinguished road
Send a message via AIM to zergmuncher
I'm using just plain old console, which will probably be what makes this interesting. We're going to println the overhead image...
zergmuncher is offline   Reply With Quote
Old 05-11-2004, 03:09 AM   #4 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
Wow, I've never even tried anything like that before. I'll try out some stuff and get back to you.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 05-12-2004, 03:23 AM   #5 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
Here's the problem you face; you can grab the input stream through System.in, but putting together the input can be tricky, as I'm not sure what bytes correspond to "left" and "right". If I were you, I'd put the whole program in a while loop and wrap System.in with BufferedInputStream. Every iteration, check to see if left or right has been pressed and do stuff accordingly.

I haven't tried this, but it's where I would start if I were doing the same project as you are.
__________________
GitS
Belisarius is offline   Reply With Quote
Reply

Bookmarks

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please HeLp Wid A game of 3 x 3 tic-tac-toe (noughts and crosses) in C++ Nightmare Standard C, C++ 1 08-11-2004 10:36 AM
Need help, C++ game patcollins Standard C, C++ 3 04-28-2004 03:43 AM
Game team needs a coder RaNger Standard C, C++ 2 07-23-2003 07:33 PM
Word association game! Eyelfixit Lounge 53 07-12-2003 11:23 PM


All times are GMT -8. The time now is 06:31 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting