View Full Version : JAVA interactive coding


Closet Philosopher
05-31-03, 11:42 AM
At achool, I was given an assignment. I have to make a Pac Man program without any image imports. I know how to make the graphics, but how would I make this interactive? I am in beginner computer code, we have just learned how to work buttons and stuff. How would IO make Pac Man move, and how can I make it animate? How would I assign arrow keys to buttons that will be hidden off the screen? how would I make loops that only work when they keys are pressed? How would i add action listeners to specific buttons, and action performed methds to specific actions?? I have all these unanswered questions.

Voodoo Child
06-01-03, 03:53 AM
Use keylistener, no buttons needed.

http://java.sun.com/docs/books/tutorial/uiswing/events/keylistener.html

It has the same principles you use with the EventListener.

Pacman is a circle with a bit missing. Redraw the circle with different size segments gone. Just change the variable responsible for determining the size of the missing segment. When pacman changes orientation, just change the position of the segment(pointing up or down or whatever). There is probably an open source pacman game out there, if not in java. You can steal ideas from that. Learn about double buffering if you haven't already.

Blindman
06-01-03, 07:25 AM
I think you have dived into the deep end of the pool..
To create a pac man game requires extensive programing experience. Some computer scientists I have met couldn't write a good pac man to save their lives..
I'm surprised that a beginner would be made to create a pac man game..

Best of luck...

CompiledMonkey
06-01-03, 06:54 PM
Originally posted by Blindman
I think you have dived into the deep end of the pool..
To create a pac man game requires extensive programing experience. Some computer scientists I have met couldn't write a good pac man to save their lives..
I'm surprised that a beginner would be made to create a pac man game..

Best of luck...

Seriously. That's quite a lot for a newbie.