Esempio n. 1
0
 private void StartGameTimer_Tick(object sender, EventArgs e)
 {
     StartTime = int.Parse(lblStartTime.Text);
     StartTime--;
     if (StartTime == 0)
     {
         ifGameStarted = true;
         StartGameTimer.Stop();
         timerCountDown.Start();
         timer2.Start();
         pStartingGame.Visible = false;
     }
     lblStartTime.Text = StartTime.ToString();
 }
Esempio n. 2
0
        public void newGame(int NumOfPlayers, List <Player> players)
        {
            name  = new List <char>();
            scene = new Scene();
            scene.GenerateMap();
            keys = new List <Keys>();
            StartGameTimer.Start();
            flashTimer             = false;
            playersLocal           = new List <Player>();
            isNewHighScore         = false;
            isGameOver             = false;
            gbHighScore.Visible    = false;
            gbHighScore.Enabled    = false;
            ifGameStarted          = false;
            positionOfText         = 0;
            enteredKeyAfterEndGame = false;

            BomberMan b1 = new BomberMan(players[0].Name, startingPoints[0], Keys.Up, Keys.Down, Keys.Left, Keys.Right, Keys.Space, BomberMan.CHARACTER.Blue);

            b1.Key = startingPoints[0];

            BomberMan b2 = new BomberMan(players[1].Name, startingPoints[1], Keys.W, Keys.S, Keys.A, Keys.D, Keys.E, BomberMan.CHARACTER.Yellow);

            b2.Key = startingPoints[1];
            BomberMan b3 = null;

            if (NumOfPlayers == 3)
            {
                b3     = new BomberMan(players[2].Name, startingPoints[2], Keys.NumPad8, Keys.NumPad5, Keys.NumPad4, Keys.NumPad6, Keys.NumPad0, BomberMan.CHARACTER.Red);
                b3.Key = startingPoints[2];
            }
            scene.AddPlayer(b1);
            scene.AddPlayer(b2);
            if (NumOfPlayers == 3)
            {
                scene.AddPlayer(b3);
            }

            Invalidate();
        }
Esempio n. 3
0
        private void SetStartSettings()
        {
            // SecToStartLabel
            //
            SecToStartLabel.AutoSize = true;
            SecToStartLabel.Font     = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            SecToStartLabel.Location = new System.Drawing.Point(284, 9);
            SecToStartLabel.Name     = "SecToStartLabel";
            SecToStartLabel.Size     = new System.Drawing.Size(86, 31);
            SecToStartLabel.TabIndex = 0;
            SecToStartLabel.Text     = "label1";
            //
            // label1
            //
            label1.AutoSize = true;
            label1.Font     = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            label1.Location = new System.Drawing.Point(12, 15);
            label1.Name     = "label1";
            label1.Size     = new System.Drawing.Size(65, 25);
            label1.TabIndex = 1;
            label1.Text     = "Очки:";
            //
            // ScoreLabel
            //
            ScoreLabel.AutoSize = true;
            ScoreLabel.Font     = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            ScoreLabel.Location = new System.Drawing.Point(70, 15);
            ScoreLabel.Name     = "ScoreLabel";
            ScoreLabel.Size     = new System.Drawing.Size(23, 25);
            ScoreLabel.TabIndex = 2;
            ScoreLabel.Text     = "0";
            //
            // RestartBtn
            //
            RestartBtn.Font     = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            RestartBtn.Location = new System.Drawing.Point(472, 9);
            RestartBtn.Name     = "RestartBtn";
            RestartBtn.Size     = new Size(120, 31);
            RestartBtn.TabIndex = 3;
            RestartBtn.Text     = "Переиграть";
            RestartBtn.UseVisualStyleBackColor = true;
            RestartBtn.Visible = false;



            StartGameTimer.Interval = 1000;


            Images = new JojoImg[] { Dio, Dzorno, Igy, Jonathan, Jozeph, Kakein, Strohaim, Valacas };

            for (int i = 0; i < 8; i++)
            {
                Images[i].Id = i;
            }

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    Cards[i, j] = new Card(i + j / 10.0);

                    Cards[i, j].Picture.Size     = new Size(120, 120);
                    Cards[i, j].Picture.SizeMode = PictureBoxSizeMode.StretchImage;

                    Cards[i, j].Picture.Location = new Point(15 + 150 * i, 50 + 150 * j);
                    this.Controls.Add(Cards[i, j].Picture);

                    RandomPic(Cards[i, j]);
                    Cards[i, j].Picture.ImageLocation = Cards[i, j].Source;
                }
            }

            Score = 0;

            SecToStart           = 3;
            SecToStartLabel.Text = SecToStart.ToString() + "...";
            StartGameTimer.Start();
        }