Results 1 to 5 of 5
Thread: Pong game
- 04-14-2010, 07:35 AM #1
Member
- Join Date
- Nov 2009
- Posts
- 54
- Rep Power
- 0
Pong game
Hi,
I'm making a kind of pong game with one ball and two beams wich you can move up and down to bounce the ball and so on. You can move the two beams with A and Q and arrow up and arrow down. My problem is that when i move one beam, i can't move the other and otherwise. I've tried to use a thread in my keylistener but that didn't work. Any suggestions?
HannesLast edited by hannes; 04-14-2010 at 07:34 PM.
-
No need for a background thread as a Swing Timer would do the trick nicely (although it does use a background thread behind the scenes to accomplish its tasks).
- 04-14-2010, 07:36 PM #3
Member
- Join Date
- Nov 2009
- Posts
- 54
- Rep Power
- 0
But what should i do then? When i press on A to get the first beam higher, then i can't get the second beam down when i press on arrow up;
-
It's very hard to say without knowing what your code is doing. Myself, I'd use a Swing Timer and key bindings. I would not use a KeyListener for this.
I also would try to work on just this problem in isolation, in a small program that does nothing but move two rectangles. Once solved in the small program, then and only then integrate it into the large program. If the small program doesn't work, then post it here (we definitely don't want to see the whole big program).
Best of luck.
- 02-03-2011, 10:52 AM #5kevinpeter Guest
Similar Threads
-
Ping pong game
By adam405 in forum New To JavaReplies: 8Last Post: 10-20-2010, 03:52 PM -
Implementing "Game Over" in Minesweeper game based on Gridworld framework.
By JFlash in forum New To JavaReplies: 2Last Post: 08-05-2010, 04:49 AM -
The bug in the Pong game
By Phoeenix in forum New To JavaReplies: 4Last Post: 07-21-2009, 07:13 PM -
Pong Paddle Not Stopping Ball At Certain Speed
By JDCAce in forum Java AppletsReplies: 3Last Post: 04-01-2009, 11:07 PM -
Help with pong game
By Eric in forum New To JavaReplies: 2Last Post: 07-03-2007, 07:02 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks