示例#1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (Progress.Value != 10)
            {
                Progress.Value++;
            }
            else
            {
                timer1.Stop();
                GAMEPanel.Visible = true;
                INFOPanel.Visible = true;
                Progress.Visible  = false;
                label2.Visible    = false;
                this.ClientSize   = new System.Drawing.Size(1275, 746);

                timeLeft       = 60;
                timeLabel.Text = "60 seconds";
                TTimeLeft.Start();
            }
        }
示例#2
0
        // KEY IS DOWN
        private void GameWindow_KeyDown(object sender, KeyEventArgs e)
        {
            if (isPaused == false)
            {
                if (e.KeyCode == Keys.Right)
                {
                    goright = true;
                }
                if (e.KeyCode == Keys.Up)
                {
                    goup = true;
                }
                if (e.KeyCode == Keys.Left)
                {
                    goleft = true;
                }
                if (e.KeyCode == Keys.Down)
                {
                    godown = true;
                }
            }

            if (e.Control && e.KeyCode == Keys.M)
            {
                AreYouSure ays = new AreYouSure();
                ays.Info  = "Are you sure you want to go to the main menu?";
                ays.Info2 = "You will lose your progress";
                ays.ShowDialog();
                if (ays.DialogResult == DialogResult.OK)
                {
                    ays.Close();
                    CTRLM();
                }
                else if (ays.DialogResult == DialogResult.Cancel)
                {
                    ays.Close();
                }
            }
            if (e.Control && (e.KeyCode == Keys.Q))
            {
                AreYouSure ays = new AreYouSure();
                ays.Info  = "Are you sure you want to quit the game?";
                ays.Info2 = "You will lose your progress.";
                ays.ShowDialog();
                if (ays.DialogResult == DialogResult.OK)
                {
                    ays.Close();
                    CTRLQ();
                }
                else if (ays.DialogResult == DialogResult.Cancel)
                {
                    ays.Close();
                }
            }
            if (e.Control && (e.KeyCode == Keys.P))
            {
                if (isPaused == false)
                {
                    CTRLP();
                    isPaused = true;
                }
                else if (isPaused == true)
                {
                    isPaused = false;
                    MessageBox.Show("Now you can continue playing", "UNPAUSED", MessageBoxButtons.OK);
                    TTimeLeft.Start();
                    play.PlayLooping();
                }
            }
        }