954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Please help me with a java terminal snake game

Hi, I would like to make a terminal (non gui, the dos texty type interface) snake game and have a general idea of what to do but would like some help with the following: how do I make the walls? and how do I catch the keyboard input to move the snake (preferrably would like to use the arrow keys such that up moves the snake up, left moves the snake left, right moves the snake right, and down moves the snake down)? Thanks! :)

hexstar
Posting Whiz in Training
212 posts since Aug 2004
Reputation Points: 21
Solved Threads: 2
 

Well before you answer those questions...
How are you gonna draw it?
If you use System.out.println(..) to print to screen, it just prints what you said, you can't update it.
You could keep redrawing the snake, but in your command prompt you wil just see a huge list of snakes as you scroll, and it would be very flashy when viewing it.

I would have a crack at GUI's.
It is difficult when you start, but its probably best to start with a JFrame and a JPanel, and try some graphics.
Try out my chess, might give some inspiration (or it might not).
http://www.colin-java.co.uk/JChess/index.htm

cms271828
Junior Poster
123 posts since Oct 2006
Reputation Points: 20
Solved Threads: 4
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You