Exemplo n.º 1
0
 public void CTRLP()
 {
     if (isPaused == false)
     {
         TTimeLeft.Stop();
         MessageBox.Show("Now the game is paused", "PAUSE", MessageBoxButtons.OK);
         play.Stop();
     }
 }
Exemplo n.º 2
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();
            }
        }
Exemplo n.º 3
0
 /////////////////// TIME COUNTING //////////////////////
 public void goingtime()
 {
     if (timeLeft > 0)
     {
         // Display the new time left
         // by updating the Time Left label.
         timeLeft       = timeLeft - 1;
         timeLabel.Text = timeLeft + " seconds";
     }
     else
     {
         // If the user ran out of time, stop the timer, show
         // a MessageBox, and fill in the answers.
         TTimeLeft.Stop();
         MessageBox.Show("The time ran out!", "STOP!");
         timeLabel.Text = "";
         catcher        = Convert.ToInt32(LScore.Text);
         EndGame();
     }
 }
Exemplo n.º 4
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();
                }
            }
        }