I'm creating a simple, old, black and white tennis game for practice. I've created an event handler for 9 keys - 2 for moving 2 paddles up, 2 for moving them down, 2 for left and 2 for right. I also have an Enter key that starts the ball moving. The problem is that when I press Enter, none of my other keys work, until the ball goes off the screen. Does anyone have any suggestions how to fix this

2 events at once
wrreagle70
Here is the code:
private
void Start_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e){
//Down1
if(e.KeyCode == Keys.S){
if(paddle3.Top < 315){
int y = paddle3.Top+3;paddle3.Top = y;
}
}
//Up1 if(e.KeyCode == Keys.W){
if(paddle3.Top > 0){
int y = paddle3.Top-3;paddle3.Top = y;
}
}
//Left1 if(e.KeyCode == Keys.A){
if(paddle3.Left > 0){
int x = paddle3.Left-3;paddle3.Left = x;
}
}
//Right1 if(e.KeyCode == Keys.D){
if(paddle3.Left < 235){
int x = paddle3.Left+3;paddle3.Left = x;
}
}
//Down2 if(e.KeyCode == Keys.K){
if(paddle2.Top < 315){
int y = paddle2.Top+3;paddle2.Top = y;
}
}
//Up2 if(e.KeyCode == Keys.I){
if(paddle2.Top > 0){
int y = paddle2.Top-3;paddle2.Top = y;
}
}
//Left2 if(e.KeyCode == Keys.J){
if(paddle2.Left > 350){
int x = paddle2.Left-3;paddle2.Left = x;
}
}
//Right2 if(e.KeyCode == Keys.L){
if(paddle2.Left < 575){
int x = paddle2.Left+3;paddle2.Left = x;
}
}
if(e.KeyCode == Keys.Enter){
moveBall();
}
}
Jo&#38;&#35;227&#59;o Leite
Brock Taylor
hi,
i'm not expert with animation but how do you update your paddle
UKGENT
AvalonBliss
Thanks for all of the help from everyone, but I've already found the problem and now everything works perfectly.
What happened, was that moveBal() was a function that moved the ball by 1 to 5 pixels in each direction. This happened in a 'for' cycle that only ended when the ball went off the screen. Thus, the call kept reoccuring, and none of my other handlers would work. I fixed this by impleminting a timer, which moved the ball with each tick of 5 milliseconds, and changed by Enter handler to start the timer.
SeonBong
Sheng Jiang (?晟)
teyc
Gouranga1
Moiss
JohanBarnard
I see that you have implemented all that on single thread .
Try using multithreaded approach so as to keep your User interface responsive .
Thanx
mepurathu
hi,
ok explain the solution and mark it as answer , it might help someone else
best regards