示例#1
0
        public Form1()
        {
            InitializeComponent();

            pause_Button.Enabled = false;
            spaceShipPos_X       = spaceShip.Location.X;
            spaceShipPos_Y       = spaceShip.Location.Y;

            score_label.Text    = "Score: " + score;
            attempts_label.Text = "Attempts: " + attempts;
            enemies             = new PictureBox[7] {
                rocket1, rocket2, rocket3, leftShip, rightShip, darkShip1, darkShip2
            };

            for (int i = 0; i < 3; i++)
            {
                enemy_rand_pos[i] = rnd.Next(0, 40) * 20;
            }
            for (int i = 3; i < 5; i++)
            {
                enemy_rand_pos[i] = rnd.Next(0, 25) * 20;
            }
            for (int i = 5; i < enemies.Length; i++)
            {
                enemy_rand_pos[i] = rnd.Next(0, 40) * 20;
            }

            Mp3Player.open_file(soundtrack_file);
        }
示例#2
0
 private void pause_ButtonClick(object sender, EventArgs e)
 {
     timer.Stop();
     Mp3Player.stop();
     KeyDown -= new KeyEventHandler(Form1_KeyDown);
     pause_Button.Enabled = false;
     start_Button.Enabled = true;
 }
示例#3
0
 private void start_ButtonClick(object sender, EventArgs e)
 {
     Mp3Player.play();
     KeyDown += new KeyEventHandler(Form1_KeyDown);
     if (level == "easy")
     {
         easy_ButtonClick(sender, e);
     }
     else if (level == "normal")
     {
         normal_ButtonClick(sender, e);
     }
     else if (level == "hard")
     {
         hard_ButtonClick(sender, e);
     }
     timer.Start();
     start_Button.Enabled = false;
     pause_Button.Enabled = true;
     score_label.Text     = "Score: " + score;
     attempts_label.Text  = "Attempts: " + attempts;
 }