Guest User

Untitled

a guest
Oct 20th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. private void NumericUpDownVx_ValueChanged(object sender, EventArgs e)
  2. {
  3.  
  4. }
  5.  
  6. private void NumericUpDownVy_ValueChanged(object sender, EventArgs e)
  7. {
  8.  
  9. }
  10.  
  11. private void ButtonStart_Click(object sender, EventArgs e)
  12. {
  13.  
  14.  
  15. if (buttonStart.Text == "Start")
  16.  
  17. {
  18. numericUpDownVx.Enabled = false;
  19. numericUpDownVy.Enabled = false;
  20.  
  21. buttonStart.Text = "Stop";
  22.  
  23. Timer1.Start();
  24.  
  25. }
  26.  
  27.  
  28. else if (buttonStart.Text == "Stop")
  29. {
  30. numericUpDownVx.Enabled = true;
  31. numericUpDownVy.Enabled = true;
  32. buttonStart.Text = "Start";
  33. Timer1.Stop();
  34. Timer2.Stop();
  35. Timer3.Stop();
  36. Timer4.Stop();
  37. }
  38. }
  39.  
  40. private void Timer1_Tick(object sender, EventArgs e)
  41. {
  42. ball.Top += 5;
  43. ball.Left += 5;
  44.  
  45. if (ball.Left + ball.Width > Mesa.Width)
  46. {
  47. Timer1.Stop();
  48. Timer2.Start();
  49. }
  50.  
  51. if (ball.Top + ball.Height > Mesa.Height)
  52. {
  53. Timer1.Stop();
  54. Timer3.Start();
  55. }
  56. }
  57.  
  58. private void Timer2_Tick(object sender, EventArgs e)
  59. {
  60. ball.Top += 5;
  61. ball.Left -= 5;
  62.  
  63. if (ball.Top + ball.Height > Mesa.Height)
  64. {
  65. Timer2.Stop();
  66. Timer4.Start();
  67. }
  68.  
  69. if (ball.Left < 0)
  70. {
  71. Timer2.Stop();
  72. Timer1.Start();
  73. }
  74. }
  75.  
  76. private void Timer3_Tick(object sender, EventArgs e)
  77. {
  78. ball.Top -= 5;
  79. ball.Left += 5;
  80.  
  81. if (ball.Left + ball.Width > Mesa.Width)
  82. {
  83. Timer3.Stop();
  84. Timer4.Start();
  85. }
  86.  
  87. if (ball.Top < 0)
  88. {
  89. Timer3.Stop();
  90. Timer1.Start();
  91. }
  92. }
  93.  
  94. private void Timer4_Tick(object sender, EventArgs e)
  95. {
  96. ball.Top -= 5;
  97. ball.Left -= 5;
  98.  
  99. if (ball.Left < 0)
  100. {
  101. Timer4.Stop();
  102. Timer3.Start();
  103. }
  104.  
  105. if (ball.Top < 0)
  106. {
  107. Timer4.Stop();
  108. Timer2.Start();
  109. }
  110. }
Add Comment
Please, Sign In to add comment