示例#1
0
        /// <summary>
        /// Method responsible for start moving
        /// </summary>
        /// <param name="sender">The event sender</param>
        /// <param name="e">The event object</param>
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (!pause)
            {
                if (e.KeyCode == Keys.Right)
                {
                    if (speedLvl < 5)//improve speed
                    {
                        RightTimer.Interval = 5 - speedLvl;
                    }
                    RightTimer.Start();
                }
                if (e.KeyCode == Keys.Left)
                {
                    if (speedLvl < 5)//imporve speed
                    {
                        LeftTimer.Interval = 5 - speedLvl;
                    }
                    LeftTimer.Start();
                }

                //start fire
                if (e.KeyCode == Keys.A)
                {
                    if (bullets <= 3) //more bullets, more intervals of shooting
                    {
                        MunitionTimer.Interval = 31 - 10 * bullets;
                    }
                    MunitionTimer.Start();
                }
            }
        }
示例#2
0
 /// <summary>
 /// start timers method
 /// </summary>
 private void StartTimers()
 {
     MoveBackground.Start();
     RightTimer.Start();
     LeftTimer.Start();
     MoveEnemiesTimer.Start();
     MunitionTimer.Start();
     EnemiesMunitionTimer.Start();
 }