File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes A problem in my PONG game code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A problem in my PONG game code" Watch "A problem in my PONG game code" New topic
Author

A problem in my PONG game code

max wang
Greenhorn

Joined: Jan 10, 2008
Posts: 7


I change the code, PONG game works. But there is a new problem, the hit score and misses score must show in the title bar of frame. mp.setTitle("Pong Demo"+"hit="+hit+"misses:"+misses); cannot show the score. The problem is that I cannot send the hit and misses variable to the frames. when they change.

[ May 27, 2008: Message edited by: max wang ]
[ May 27, 2008: Message edited by: max wang ]
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4522
    
    5

Comments:

Key events are received only by the focus owner, for this kind of application you would be better served by using key bindings.
The Java Tutorials: How to Use Key Bindings.

What key listener do you add to DrawPanel dp? Did you really mean to add a new KeyCnt()? What is the code in that class? since you didn't post it.

At two places in the code posted, you have else without if. The purpose of posting code is defeated if the code posted has syntax errors. (except where the problem is the syntax error)

And when all else is sorted out, you're going to discover that the down arrow moves the paddle up and vice versa


luck, db
There are no new questions, but there may be new answers.
max wang
Greenhorn

Joined: Jan 10, 2008
Posts: 7
Darryl , I made a mistake on post in stead of the source code. I try to fix according to your comment. Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A problem in my PONG game code
 
Similar Threads
Double Buffering Problem
Suggestions to make code (Pong) better (from the code I have, not adding additional code)
can not move the paddle in this program
slowing down movement in an applet.... doesn't have anything to do with the applet.
removing listeners