Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void NumericUpDownVx_ValueChanged(object sender, EventArgs e)
- {
- }
- private void NumericUpDownVy_ValueChanged(object sender, EventArgs e)
- {
- }
- private void ButtonStart_Click(object sender, EventArgs e)
- {
- if (buttonStart.Text == "Start")
- {
- numericUpDownVx.Enabled = false;
- numericUpDownVy.Enabled = false;
- buttonStart.Text = "Stop";
- Timer1.Start();
- }
- else if (buttonStart.Text == "Stop")
- {
- numericUpDownVx.Enabled = true;
- numericUpDownVy.Enabled = true;
- buttonStart.Text = "Start";
- Timer1.Stop();
- Timer2.Stop();
- Timer3.Stop();
- Timer4.Stop();
- }
- }
- private void Timer1_Tick(object sender, EventArgs e)
- {
- ball.Top += 5;
- ball.Left += 5;
- if (ball.Left + ball.Width > Mesa.Width)
- {
- Timer1.Stop();
- Timer2.Start();
- }
- if (ball.Top + ball.Height > Mesa.Height)
- {
- Timer1.Stop();
- Timer3.Start();
- }
- }
- private void Timer2_Tick(object sender, EventArgs e)
- {
- ball.Top += 5;
- ball.Left -= 5;
- if (ball.Top + ball.Height > Mesa.Height)
- {
- Timer2.Stop();
- Timer4.Start();
- }
- if (ball.Left < 0)
- {
- Timer2.Stop();
- Timer1.Start();
- }
- }
- private void Timer3_Tick(object sender, EventArgs e)
- {
- ball.Top -= 5;
- ball.Left += 5;
- if (ball.Left + ball.Width > Mesa.Width)
- {
- Timer3.Stop();
- Timer4.Start();
- }
- if (ball.Top < 0)
- {
- Timer3.Stop();
- Timer1.Start();
- }
- }
- private void Timer4_Tick(object sender, EventArgs e)
- {
- ball.Top -= 5;
- ball.Left -= 5;
- if (ball.Left < 0)
- {
- Timer4.Stop();
- Timer3.Start();
- }
- if (ball.Top < 0)
- {
- Timer4.Stop();
- Timer2.Start();
- }
- }
Add Comment
Please, Sign In to add comment