Beispiel #1
0
        //Создаем персонажа
        private void InitStartPlayer(int boxSize)
        {
            //Координаты появления
            int x = 1, y = 1;

            PictureBox picture = new PictureBox();

            //Выравниваем персонажа по центру клетки
            picture.Location = new Point(x * (boxSize) + 7, y * (boxSize) + 3);

            //Размер персонажа
            picture.Size = new Size(boxSize - 14, boxSize - 6);

            //Присваиваем изображение
            picture.Image                 = Properties.Resources.bomber;
            picture.BackgroundImage       = Properties.Resources.ground;
            picture.BackgroundImageLayout = ImageLayout.Stretch;
            picture.SizeMode              = PictureBoxSizeMode.StretchImage;

            //Добавляем на панель
            GamePanel.Controls.Add(picture);

            //Выставляем персонажа на передний план
            picture.BringToFront();

            bomber = new Bomber(picture, mapPic, map, score);
        }
 public Enemy(PictureBox picEnemy, PictureBox[,] _mapPic, Condition[,] _map, Bomber _bomber)
 {
     enemy        = picEnemy;
     map          = _map;
     bomber       = _bomber;
     fmap         = new int[map.GetLength(0), map.GetLength(1)];
     path         = new Point[map.GetLength(0) * map.GetLength(1)];
     moving       = new MovingClass(picEnemy, _mapPic, _map, AddBonus);
     enemyPlace   = moving.MyNowPoint();
     destinePlace = enemyPlace;
     CreateTimer();
     timer.Enabled = true;
 }