Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool patrollingLeft = false;
- DoubleBuffered = true;
- bool stay = false;
- long ticksThisTime = 0;
- Stopwatch timer = new Stopwatch();
- timer.Start();
- float t = 2;
- float s = 625;
- float time = 0;
- while (true)
- {
- timer.Stop();
- label1.Text = time.ToString();
- ticksThisTime = timer.ElapsedMilliseconds;
- time = time + ticksThisTime / 1000.0F;
- timer.Reset();
- timer.Start();
- if (patrollingLeft && stay == false)
- {
- x = x - (s / t) * (ticksThisTime / 1000.0F);
- if (x <= 125)
- {
- patrollingLeft = false;
- time = 0;
- stay = true;
- }
- }
- else if (patrollingLeft == false && stay == false)
- {
- x = x + (s / t) * (ticksThisTime / 1000.0F);
- if (x >= 750)
- {
- patrollingLeft = true;
- time = 0;
- stay = true;
- }
- }
- else if (stay == true && time > 4)
- {
- stay = false;
- }
- gr.FillRectangle(fon, 0, 0, pictureBox1.Width, pictureBox1.Height);
- DrawCircle(x, y);
- Application.DoEvents();
- pictureBox1.Image = myBitmap;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement