Пример #1
0
 private void onMouseMove(object sender, MouseEventArgs e)
 {
     if (e.X > 0 && e.X < this.Width - 80)
     {
         paddle.ChangePosition(e.X);
     }
     if (ball.GetBlnIsGlued() == true)
     {
         ball.ChangePosition(paddle.GetRecPosition().X + 80 / 2 - (ball.GetRecPosition().Width / 2),
                             432 - 16);
     }
 }
Пример #2
0
 // onMouseMove the paddle is repositioned in the direction of the mouse.
 private void onMouseMove(object sender, MouseEventArgs e)
 {
     if (e.X > 0 && e.X < this.Width - 80)
     {
         paddle.ChangePosition(e.X);
     }
     if (ball.IsGlued())  // if ball is glued, it needs to stick with paddle
     {
         ball.ChangePosition(
             paddle.GetPosition().X + 80 / 2 - (ball.GetPosition().Width / 2),
             432 - 40);
     }
 }