Example #1
0
        public PictureBox BangKolobok(PictureBox pictureBox)
        {
            //Point coordKolobok = new Point();
            //coordKolobok
            KolobokView kolobokView = new KolobokView();

            return(kolobokView.GameOver(GetCoodinateKolobok(), pictureBox));
        }
Example #2
0
        public KolobokView AddKolobokView(Panel p_Map)
        {
            KolobokView viewPackMan = new KolobokView(p_Map);

            viewPackMan.Model         = gameModel.PackMan;
            viewPackMan.Model.MapSize = new Point(p_Map.Width, p_Map.Height);
            viewPackMan.Subscribe();
            return(viewPackMan);
        }
Example #3
0
        protected void AddElementsViews()
        {
            listViewTank   = packmanController.AddTankViews(p_Map);
            listViewWall   = packmanController.AddWallViews(p_Map);
            listViewRiver  = packmanController.AddRiverViews(p_Map);
            listViewApple  = packmanController.AddAppleViews(p_Map);
            listViewBullet = packmanController.AddBulletViews(p_Map);

            viewPackMan = packmanController.AddKolobokView(p_Map);
        }
Example #4
0
 public Kolobok(ImageList imageList, Border border, Wall wall, BrokenWall brokenWall, int speed) :
     base(imageList, border, wall, brokenWall, speed)
 {
     Score           = 0;
     IsGameOver      = false;
     CurrentPosition = new Position(20, 20);
     LastPosition    = new Position(20, 20);
     Directions      = Direction.RIGHT;
     TanksView       = new KolobokView(imageList);
 }
        public void Start(MainForm main_f)
        {
            UnSubscribe();
            Apples.Clear();
            Tanks.Clear();
            Obstacles.Clear();
            ShotsKolobok.Clear();
            ShotsTanks.Clear();
            kolobok       = null;
            gameOver      = false;
            Score         = 0;
            Delta         = 30;
            DeltaShots    = 30;
            map           = main_f.map;
            backgroundMap = new Bitmap(map.Width, map.Height);
            mapGraphics   = Graphics.FromImage(backgroundMap);
            mapGraphics.FillRectangle(Brushes.Black, 0, 0, map.Width, map.Height);
            for (int i = 0; i < mapFix.Count(); i++)
            {
                for (int j = 0; j < mapFix[i].Length; j++)
                {
                    if (mapFix[i][j] == 'X')
                    {
                        Obstacles.Add(new FixedObject(j, i, 0));
                        mapGraphics.DrawImage(Obstacles.Last().Img, Obstacles.Last().X *MainForm.sizeCell, Obstacles.Last().Y *MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                    }
                    if (mapFix[i][j] == 'Y')
                    {
                        Obstacles.Add(new FixedObject(j, i, 1));
                        mapGraphics.DrawImage(Obstacles.Last().Img, Obstacles.Last().X *MainForm.sizeCell, Obstacles.Last().Y *MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                    }
                }
            }

            RespOfApples();

            while (Tanks.Count < tanksCount)
            {
                Tanks.Add(new TankView());
                foreach (var item in Obstacles)
                {
                    if (Tanks.Last().Collide(item))
                    {
                        Tanks.RemoveAt(Tanks.Count - 1);
                        break;
                    }
                }
            }

            for (int i = 0; i < Apples.Count; i++)
            {
                mapGraphics.DrawImage(Apples[i].Img, Apples[i].X * MainForm.sizeCell, Apples[i].Y * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
            }

            for (int i = 0; i < Tanks.Count; i++)
            {
                mapGraphics.DrawImage(Tanks[i].Img, Tanks[i].X * MainForm.sizeCell, Tanks[i].Y * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
            }

            while (true)
            {
                kolobok = new KolobokView();
                if (!kolobok.CollideWithFixedObjects(Obstacles))
                {
                    break;
                }
            }

            Subscribe();
            mapGraphics.DrawImage(kolobok.Img, kolobok.X * MainForm.sizeCell, kolobok.Y * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
            map.Image = backgroundMap;
        }