Ejemplo n.º 1
0
        public void Fire(Tanks form)
        {
            int x = 0;
            int y = 0;

            switch (this.Direction)
            {
            case Direction.LEFT:
                x = this.Point.X - 16;
                y = this.Point.Y + 8;
                break;

            case Direction.UP:
                x = this.Point.X + 8;
                y = this.Point.Y - 16;
                break;

            case Direction.RIGHT:
                x = this.Point.X + this.Size.Width + 2;
                y = this.Point.Y + 8;
                break;

            case Direction.DOWN:
                x = this.Point.X + 8;
                y = this.Point.Y + this.Size.Height + 2;
                break;
            }

            Point bulletPoint = new Point(x, y);

            form.AddBullet(bulletPoint, this.Direction);
        }
Ejemplo n.º 2
0
        public override void Draw(Tanks form)
        {
            img = (Bitmap)form.Images[7];

            if ((DateTime.Now - time).TotalMilliseconds > 300)
            {
                IsHit = true;
            }

            form.g.DrawImage(this.Img, this.Point);
        }
Ejemplo n.º 3
0
        public void AddHit(Tanks tank)
        {
            var tankIndex = (int)tank;

            var points = ((int)tank + 1) * 100;

            this.enemiesHit[tankIndex]++;

            this.pointsForTanks[tankIndex] += points;

            this.Points += points;
        }
Ejemplo n.º 4
0
        public static List <GameObject> RemoveHited(List <GameObject> gameObjects, Tanks form)
        {
            for (int i = 0; i < gameObjects.Count; i++)
            {
                if (gameObjects[i].IsHit)
                {
                    gameObjects.RemoveAt(i);
                    i--;
                }
            }

            return(gameObjects);
        }
Ejemplo n.º 5
0
        internal static List <EnemyTank> AddExplosion(List <EnemyTank> enemies, Tanks form)
        {
            for (int i = 0; i < enemies.Count; i++)
            {
                if (enemies[i].IsHit)
                {
                    form.AddExplosion(enemies[i].Point);
                    enemies.RemoveAt(i);
                    i--;
                }
            }

            return(enemies);
        }
Ejemplo n.º 6
0
        public static CTank CreateTank(Tanks tankId, bool bonus)
        {
            switch (tankId)
            {
            case Tanks.Enemy1: return(new CTankEnemy1(0, 0, bonus));

            case Tanks.Enemy2: return(new CTankEnemy2(0, 0, bonus));

            case Tanks.Enemy3: return(new CTankEnemy3(0, 0, bonus));

            case Tanks.Enemy4: return(new CTankEnemy4(0, 0, bonus));

            default: return(new CTankEnemy1(0, 0, bonus));
            }
        }
Ejemplo n.º 7
0
        internal void CheckKolobok(Kolobok kolobok, Tanks form1)
        {
            Rectangle rec  = new Rectangle(this.Point, this.Size);
            Rectangle rec2 = new Rectangle(kolobok.Point, kolobok.Size);

            rec2.Inflate(60, 60);


            if (rec.IntersectsWith(rec2) && timeTillFire < 1)
            {
                this.Fire(form1);
                timeTillFire = 100;
            }
            else
            {
                timeTillFire--;
            }
        }
Ejemplo n.º 8
0
        private void CreateTanks()
        {
            int _x;
            int _y;

            while (Tanks.Count < _tanksAmount)
            {
                _x = random.Next(_fieldWidth - 20);
                _y = random.Next(_fieldHeight - 100);

                bool flag = false;

                foreach (var a in Walls)
                {
                    if (AllCollision.BoxCollides(_x, _y, 20, 20, a.XLeft, a.YUp, a.XRight - a.XLeft, a.YDown - a.YUp))
                    {
                        flag = true;
                        break;
                    }
                }

                foreach (var a in Tanks)
                {
                    if (AllCollision.BoxCollides(_x, _y, 20, 20, a.X, a.Y, 20, 20))
                    {
                        flag = true;
                        break;
                    }
                }

                if (flag == false)
                {
                    Tanks.Add(new Tank(_x, _y));
                }
            }
        }
Ejemplo n.º 9
0
        private void DoWithTanks()
        {
            Array     values  = Enum.GetValues(typeof(Direction));
            Direction tankDir = (Direction)values.GetValue(random.Next(values.Length));

            //выстрелы танков
            foreach (var t in Tanks)
            {
                if (random.Next(100) < 1)
                {
                    switch (t.TankDirection)
                    {
                    case Direction.Left:
                        Projectiles.Add(new Projectile(t.X - 22, t.Y - 5, t.TankDirection));
                        break;

                    case Direction.Right:
                        Projectiles.Add(new Projectile(t.X + 12, t.Y - 5, t.TankDirection));
                        break;

                    case Direction.Up:
                        Projectiles.Add(new Projectile(t.X - 5, t.Y - 22, t.TankDirection));
                        break;

                    case Direction.Down:
                        Projectiles.Add(new Projectile(t.X - 5, t.Y + 12, t.TankDirection));
                        break;
                    }
                }
            }

            //расчёт нового направления танка
            foreach (var a in Walls)
            {
                for (int i = 0; i < Tanks.Count; i++)
                {
                    bool wallFlag = false;
                    if (random.Next(100) < 1)
                    {
                        Tanks[i].Turn(tankDir);
                    }
                    switch (Tanks[i].TankDirection)
                    {
                    case Direction.Left:
                        if (AllCollision.BoxCollides(Tanks[i].X - 1, Tanks[i].Y, 20, 20, a.XLeft, a.YUp, a.XRight - a.XLeft, a.YDown - a.YUp))
                        {
                            wallFlag = true;
                        }
                        break;

                    case Direction.Right:
                        if (AllCollision.BoxCollides(Tanks[i].X + 1, Tanks[i].Y, 20, 20, a.XLeft, a.YUp, a.XRight - a.XLeft, a.YDown - a.YUp))
                        {
                            wallFlag = true;
                        }
                        break;

                    case Direction.Up:
                        if (AllCollision.BoxCollides(Tanks[i].X, Tanks[i].Y - 1, 20, 20, a.XLeft, a.YUp, a.XRight - a.XLeft, a.YDown - a.YUp))
                        {
                            wallFlag = true;
                        }
                        break;

                    case Direction.Down:
                        if (AllCollision.BoxCollides(Tanks[i].X, Tanks[i].Y + 1, 20, 20, a.XLeft, a.YUp, a.XRight - a.XLeft, a.YDown - a.YUp))
                        {
                            wallFlag = true;
                        }
                        break;
                    }
                    if (wallFlag)
                    {
                        Tanks[i].TurnAround();
                    }
                }
            }

            //проверка на разворот перед границей танка
            foreach (var element in Tanks)
            {
                switch (element.TankDirection)
                {
                case Direction.Left:
                    if (element.X - 1 < 0)
                    {
                        element.TurnAround();
                    }
                    break;

                case Direction.Right:
                    if (element.X + 21 > _fieldWidth)
                    {
                        element.TurnAround();
                    }
                    break;

                case Direction.Up:
                    if (element.Y - 1 < 0)
                    {
                        element.TurnAround();
                    }
                    break;

                case Direction.Down:
                    if (element.Y + 21 > _fieldHeight)
                    {
                        element.TurnAround();
                    }
                    break;
                }
            }

            //столкновение танков
            for (int i = 0; i < Tanks.Count; i++)
            {
                for (int j = 0; j < Tanks.Count; j++)
                {
                    switch (Tanks[i].TankDirection)
                    {
                    case Direction.Left:
                        if (AllCollision.BoxCollides(Tanks[i].X - 2, Tanks[i].Y, 20, 20, Tanks[j].X, Tanks[j].Y, 20, 20) && (i != j))
                        {
                            Tanks[i].TurnAround();
                            Tanks[j].TurnAround();
                        }
                        break;

                    case Direction.Right:
                        if (AllCollision.BoxCollides(Tanks[i].X + 2, Tanks[i].Y, 20, 20, Tanks[j].X, Tanks[j].Y, 20, 20) && (i != j))
                        {
                            Tanks[i].TurnAround();
                            Tanks[j].TurnAround();
                        }
                        break;

                    case Direction.Up:
                        if (AllCollision.BoxCollides(Tanks[i].X, Tanks[i].Y - 2, 20, 20, Tanks[j].X, Tanks[j].Y, 20, 20) && (i != j))
                        {
                            Tanks[i].TurnAround();
                            Tanks[j].TurnAround();
                        }
                        break;

                    case Direction.Down:
                        if (AllCollision.BoxCollides(Tanks[i].X, Tanks[i].Y + 2, 20, 20, Tanks[j].X, Tanks[j].Y, 20, 20) && (i != j))
                        {
                            Tanks[i].TurnAround();
                            Tanks[j].TurnAround();
                        }
                        break;
                    }
                }
            }

            //столкновение танков с пулей
            foreach (var a in PackmanProjectiles)
            {
                for (int i = 0; i < Tanks.Count; i++)
                {
                    if (AllCollision.BoxCollides(Tanks[i].X, Tanks[i].Y, 20, 20, a.X, a.Y, 10, 10))
                    {
                        Tanks.Remove(Tanks[i]);
                        CreateTanks();
                        break;
                    }
                }
            }

            //движение
            foreach (var t in Tanks)
            {
                t.Run();
            }
        }
Ejemplo n.º 10
0
        internal static List <GameObject> AddExplosion(List <GameObject> gameObjects, Tanks form)
        {
            for (int i = 0; i < gameObjects.Count; i++)
            {
                if (gameObjects[i].IsHit)
                {
                    form.AddExplosion(gameObjects[i].Point);
                    gameObjects.RemoveAt(i);
                    i--;
                }
            }

            return(gameObjects);
        }
Ejemplo n.º 11
0
 public virtual void Draw(Tanks form)
 {
     form.g.DrawImage(this.Img, this.Point);
 }
Ejemplo n.º 12
0
        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;
        }
Ejemplo n.º 13
0
        public void StepOfShots()
        {
            while (DeltaShots != MainForm.sizeCell + 5)
            {
                for (int i = 0; i < ShotsKolobok.Count; i++)
                {
                    Move(ShotsKolobok[i], DeltaShots);
                }

                for (int i = 0; i < ShotsTanks.Count; i++)
                {
                    Move(ShotsTanks[i], DeltaShots);
                }

                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 < Obstacles.Count; i++)
                {
                    if (Obstacles[i].Ability == 1)
                    {
                        mapGraphics.DrawImage(Obstacles[i].Img, Obstacles[i].X * MainForm.sizeCell, Obstacles[i].Y * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                    }
                }

                DeltaShots += 5;
                map.Image   = backgroundMap;
                return;
            }


            DeltaShots = 5;

            for (int j = 0; j < ShotsTanks.Count; j++)
            {
                if (kolobok.Collide(ShotsTanks[j]))
                {
                    gameOver = true;
                    break;
                }
            }

            for (int i = 0; i < Tanks.Count; i++)
            {
                for (int j = 0; j < ShotsKolobok.Count; j++)
                {
                    if (Tanks[i].Collide(ShotsKolobok[j]))
                    {
                        mapGraphics.FillRectangle(Brushes.Black, Tanks[i].PrevX * MainForm.sizeCell, Tanks[i].PrevY * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, ShotsKolobok[j].X * MainForm.sizeCell, ShotsKolobok[j].Y * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, Tanks[i].X * MainForm.sizeCell, Tanks[i].Y * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, ShotsKolobok[j].PrevX * MainForm.sizeCell, ShotsKolobok[j].PrevY * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                        Tanks.RemoveAt(i);
                        ShotsKolobok.RemoveAt(j);
                        i--;
                        j--;
                        break;
                    }
                }
            }


            for (int i = 0; i < ShotsKolobok.Count; i++)
            {
                ShotsKolobok[i].Move();
                var index = ShotsKolobok[i].InteractWithFixedObjects(Obstacles);
                if (index > 0)
                {
                    mapGraphics.FillRectangle(Brushes.Black, ShotsKolobok[i].PrevX * MainForm.sizeCell, ShotsKolobok[i].PrevY * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                    mapGraphics.FillRectangle(Brushes.Black, Obstacles[index].X * MainForm.sizeCell, Obstacles[index].Y * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                    Obstacles.RemoveAt(index);
                    ShotsKolobok.RemoveAt(i);
                }
            }

            for (int i = 0; i < ShotsTanks.Count; i++)
            {
                ShotsTanks[i].Move();

                /*if (ShotsTanks[i].CollideWithFixedObjects(Obstacles))
                 * {
                 *  mapGraphics.FillRectangle(Brushes.Black, ShotsTanks[i].PrevX * MainForm.sizeCell, ShotsTanks[i].PrevY * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                 *  ShotsTanks.RemoveAt(i);
                 *  i--;
                 *  continue;
                 * }*/
                var index = ShotsTanks[i].InteractWithFixedObjects(Obstacles);
                if (index > 0)
                {
                    mapGraphics.FillRectangle(Brushes.Black, ShotsTanks[i].PrevX * MainForm.sizeCell, ShotsTanks[i].PrevY * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                    mapGraphics.FillRectangle(Brushes.Black, Obstacles[index].X * MainForm.sizeCell, Obstacles[index].Y * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                    Obstacles.RemoveAt(index);
                    ShotsTanks.RemoveAt(i);
                    i--;
                    continue;
                }
                if (kolobok.Collide(ShotsTanks[i]))
                {
                    gameOver = true;
                    break;
                }
            }


            for (int i = 0; i < Tanks.Count; i++)
            {
                for (int j = 0; j < ShotsKolobok.Count; j++)
                {
                    if (Tanks[i].Collide(ShotsKolobok[j]))
                    {
                        mapGraphics.FillRectangle(Brushes.Black, Tanks[i].PrevX * MainForm.sizeCell, Tanks[i].PrevY * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, ShotsKolobok[j].X * MainForm.sizeCell, ShotsKolobok[j].Y * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, Tanks[i].X * MainForm.sizeCell, Tanks[i].Y * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, ShotsKolobok[j].PrevX * MainForm.sizeCell, ShotsKolobok[j].PrevY * MainForm.sizeCell, MainForm.sizeCell, MainForm.sizeCell);
                        Tanks.RemoveAt(i);
                        ShotsKolobok.RemoveAt(j);
                        i--;
                        j--;
                        break;
                    }
                }
            }



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

            RespOfApples();
            DeltaShots += 5;
            map.Image   = backgroundMap;
        }
Ejemplo n.º 14
0
        public void Start(TanksForm fm)
        {
            UnSubscribe();
            Apples.Clear();
            Tanks.Clear();
            Walls.Clear();
            ShotsKolobok.Clear();
            ShotsTanks.Clear();
            kolobok       = null;
            gameOver      = false;
            Score         = 0;
            Delta         = 30;
            DeltaShots    = 30;
            map           = fm.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 < example.Count(); i++)
            {
                for (int j = 0; j < example[i].Length; j++)
                {
                    if (example[i][j] == 'X')
                    {
                        Walls.Add(new Wall(j, i));
                        mapGraphics.DrawImage(Walls.Last().Img, Walls.Last().X *TanksForm.sizeCell, Walls.Last().Y *TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
                    }
                }
            }


            SpawnApples();

            while (Tanks.Count < tanksCount)
            {
                Tanks.Add(new Tank());
                foreach (var item in Walls)
                {
                    if (Tanks.Last().CollidesWith(item))
                    {
                        Tanks.RemoveAt(Tanks.Count - 1);
                        break;
                    }
                }
            }

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

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

            while (true)
            {
                kolobok = new Kolobok();
                if (!kolobok.CollidesWithWalls(Walls))
                {
                    break;
                }
            }

            Subscribe();
            mapGraphics.DrawImage(kolobok.Img, kolobok.X * TanksForm.sizeCell, kolobok.Y * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
            map.Image = backgroundMap;
        }
Ejemplo n.º 15
0
        public void StepOfShots()
        {
            while (DeltaShots != TanksForm.sizeCell + 5)
            {
                for (int i = 0; i < ShotsKolobok.Count; i++)
                {
                    Move(ShotsKolobok[i], DeltaShots);
                }

                for (int i = 0; i < ShotsTanks.Count; i++)
                {
                    Move(ShotsTanks[i], DeltaShots);
                }



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

                DeltaShots += 5;
                map.Image   = backgroundMap;
                return;
            }


            DeltaShots = 5;



            for (int j = 0; j < ShotsTanks.Count; j++)
            {
                if (kolobok.CollidesWith(ShotsTanks[j]))
                {
                    gameOver = true;
                    break;
                }
            }

            for (int i = 0; i < Tanks.Count; i++)
            {
                for (int j = 0; j < ShotsKolobok.Count; j++)
                {
                    if (Tanks[i].CollidesWith(ShotsKolobok[j]))
                    {
                        mapGraphics.FillRectangle(Brushes.Black, Tanks[i].OldX * TanksForm.sizeCell, Tanks[i].OldY * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, ShotsKolobok[j].X * TanksForm.sizeCell, ShotsKolobok[j].Y * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, Tanks[i].X * TanksForm.sizeCell, Tanks[i].Y * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, ShotsKolobok[j].OldX * TanksForm.sizeCell, ShotsKolobok[j].OldY * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
                        Tanks.RemoveAt(i);
                        ShotsKolobok.RemoveAt(j);
                        i--;
                        j--;
                        break;
                    }
                }
            }


            for (int i = 0; i < ShotsKolobok.Count; i++)
            {
                ShotsKolobok[i].Move();
                if (ShotsKolobok[i].CollidesWithWalls(Walls))
                {
                    mapGraphics.FillRectangle(Brushes.Black, ShotsKolobok[i].OldX * TanksForm.sizeCell, ShotsKolobok[i].OldY * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
                    ShotsKolobok.RemoveAt(i);
                    i--;
                }
            }

            for (int i = 0; i < ShotsTanks.Count; i++)
            {
                ShotsTanks[i].Move();
                if (ShotsTanks[i].CollidesWithWalls(Walls))
                {
                    mapGraphics.FillRectangle(Brushes.Black, ShotsTanks[i].OldX * TanksForm.sizeCell, ShotsTanks[i].OldY * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
                    ShotsTanks.RemoveAt(i);
                    i--;
                    continue;
                }
                if (kolobok.CollidesWith(ShotsTanks[i]))
                {
                    gameOver = true;
                    break;
                }
            }


            for (int i = 0; i < Tanks.Count; i++)
            {
                for (int j = 0; j < ShotsKolobok.Count; j++)
                {
                    if (Tanks[i].CollidesWith(ShotsKolobok[j]))
                    {
                        mapGraphics.FillRectangle(Brushes.Black, Tanks[i].OldX * TanksForm.sizeCell, Tanks[i].OldY * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, ShotsKolobok[j].X * TanksForm.sizeCell, ShotsKolobok[j].Y * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, Tanks[i].X * TanksForm.sizeCell, Tanks[i].Y * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
                        mapGraphics.FillRectangle(Brushes.Black, ShotsKolobok[j].OldX * TanksForm.sizeCell, ShotsKolobok[j].OldY * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
                        Tanks.RemoveAt(i);
                        ShotsKolobok.RemoveAt(j);
                        i--;
                        j--;
                        break;
                    }
                }
            }



            for (int i = 0; i < Apples.Count; i++)
            {
                if (Apples[i].CollidesWith(kolobok))
                {
                    Apples.RemoveAt(i);
                    Score++;
                    break;
                }
                mapGraphics.DrawImage(Apples[i].Img, Apples[i].X * TanksForm.sizeCell, Apples[i].Y * TanksForm.sizeCell, TanksForm.sizeCell, TanksForm.sizeCell);
            }

            SpawnApples();
            DeltaShots += 5;
            map.Image   = backgroundMap;
        }