コード例 #1
0
ファイル: Form1.cs プロジェクト: HowdareyouBass/AimTraining
 private void Retry_Click(object sender, EventArgs e)
 {
     Score       = 0;
     ShowSpeed   = 1000;
     SquareW     = 100;
     Speed       = 5;
     SquareSpeed = 2;
     label1.Hide();
     Retry.Hide();
     MainMenu.Hide();
     timer1.Start();
     timer2.Start();
     timer3.Start();
     Invalidate();
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: HowdareyouBass/AimTraining
        public Form1(int hard)
        {
            InitializeComponent();
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
            ShowSpeed   = 1000;
            SquareW     = 100;
            Speed       = 5;
            SquareSpeed = 2;
            ScoreX      = 100;
            Score       = 0;
            HeightT     = 700;
            WidthT      = 1200;
            this.Size   = new Size(WidthT, HeightT);
            harder      = hard;

            label1.Location = new Point((Width - label1.Size.Width) / 2, (Height - label1.Size.Height) / 2);

            label1.Hide();
            Retry.Hide();
            MainMenu.Hide();

            Random rnd = new Random();

            if (hard == 1)
            {
                SquareW = 100;
            }
            if (hard == 2)
            {
                SquareW = 70;
            }
            if (hard == 3)
            {
                SquareW = 50;
            }
            if (hard == 4)
            {
                SquareW = 30;
            }

            Rect1  = new Enemy(rnd.Next(0, (WidthT - 5) - SquareW), rnd.Next(0, (HeightT - 15) - SquareW), SquareW, false, true, true);
            Rect2  = new Enemy(rnd.Next(0, (WidthT - 5) - SquareW), rnd.Next(0, (HeightT - 15) - SquareW), SquareW, true, true, true);
            Rect3  = new Enemy(rnd.Next(0, (WidthT - 5) - SquareW), rnd.Next(0, (HeightT - 15) - SquareW), SquareW, true, true, true);
            Rect4  = new Enemy(rnd.Next(0, (WidthT - 5) - SquareW), rnd.Next(0, (HeightT - 15) - SquareW), SquareW, true, true, true);
            Rect5  = new Enemy(rnd.Next(0, (WidthT - 5) - SquareW), rnd.Next(0, (HeightT - 15) - SquareW), SquareW, true, true, true);
            Rect6  = new Enemy(rnd.Next(0, (WidthT - 5) - SquareW), rnd.Next(0, (HeightT - 15) - SquareW), SquareW, true, true, true);
            Rect7  = new Enemy(rnd.Next(0, (WidthT - 5) - SquareW), rnd.Next(0, (HeightT - 15) - SquareW), SquareW, true, true, true);
            Rect8  = new Enemy(rnd.Next(0, (WidthT - 5) - SquareW), rnd.Next(0, (HeightT - 15) - SquareW), SquareW, true, true, true);
            Rect9  = new Enemy(rnd.Next(0, (WidthT - 5) - SquareW), rnd.Next(0, (HeightT - 15) - SquareW), SquareW, true, true, true);
            Rect10 = new Enemy(rnd.Next(0, (WidthT - 5) - SquareW), rnd.Next(0, (HeightT - 15) - SquareW), SquareW, true, true, true);

            Rndall();

            timer1.Interval = Speed;
            timer2.Interval = Speed - 1;
            timer3.Interval = ShowSpeed;
            timer4.Interval = 1;
            timer5.Interval = 20000;
            timer1.Tick    += new EventHandler(update);
            timer2.Tick    += new EventHandler(BounceUpdate);
            timer3.Tick    += new EventHandler(ShowRnd);
            timer4.Tick    += new EventHandler(UpdateAll);
            timer5.Tick    += new EventHandler(YouLose);
            timer1.Start();
            timer2.Start();
            timer3.Start();
            timer4.Start();
            this.MouseDown += Check;
        }