JAVA interactive coding

Discussion in 'Computer Science & Culture' started by Closet Philosopher, May 31, 2003.

Thread Status:
Not open for further replies.
  1. Closet Philosopher Off to Laurentian University Registered Senior Member

    Messages:
    1,785
    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.
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Voodoo Child Registered Senior Member

    Messages:
    1,296
    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.
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. Blindman Valued Senior Member

    Messages:
    1,425
    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...
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. CompiledMonkey The Lurker Registered Senior Member

    Messages:
    96
    Seriously. That's quite a lot for a newbie.
     
Thread Status:
Not open for further replies.

Share This Page