Advertisement
BlackPymer

Untitled

Apr 18th, 2022
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace DinoOnC1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public bool isLiving = true;
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.  
  20.         }
  21.         public async Task MoveRoad(Label r)
  22.         {
  23.             await Task.Run(() =>
  24.             {
  25.                 while (isLiving)
  26.                 {
  27.                     r.Location = new Point(r.Location.X, r.Location.Y - 1);
  28.                     if (r.Location.Y < -1000)
  29.                     {
  30.                         r.Location = new Point(r.Location.X, 1000);
  31.                     }
  32.                 }
  33.             });
  34.         }
  35.        
  36.         private void Form1_Load(object sender, EventArgs e)
  37.         {
  38.            
  39.             MoveRoad(road1);
  40.             MoveRoad(road2);
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement