示例#1
0
 private void StartTimers()
 {
     LeftMoveTimer.Start();
     RightMoveTimer.Start();
     LaserTimer.Start();
     EnemiesTimer.Start();
 }
示例#2
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Left)
            {
                if (Spaceship.spaceshipX > 20)
                {
                    LeftMoveTimer.Start();
                }
                else
                {
                    LeftMoveTimer.Stop();
                    Spaceship.spaceshipV = 0;
                }
            }
            if (e.KeyCode == Keys.Right)
            {
                if (Spaceship.spaceshipX < 580)
                {
                    RightMoveTimer.Start();
                }
                else
                {
                    RightMoveTimer.Stop();
                    Spaceship.spaceshipV = 0;
                }
            }

            if (e.KeyCode == Keys.Space)
            {
                LaserTimer.Start();
            }

            if (e.KeyCode == Keys.R)
            {
                ResetGame();
            }
        }