Esempio n. 1
0
        public int burstX, burstY, burstDX, burstDY; //координаты и размеры взрыва

        public Bullet(int x, int y, int dx, int dy, moveDirectionEnum dir)
        {
            this.x   = x;
            this.y   = y;
            this.dx  = dx;
            this.dy  = dy;
            this.dir = dir;
            BBIT     = bullBit;
            #region выбор картинки
            switch (dir)
            {
            case moveDirectionEnum.Left:
                BBIT.RotateFlip(RotateFlipType.Rotate270FlipNone);
                break;

            case moveDirectionEnum.Right:
                BBIT.RotateFlip(RotateFlipType.Rotate90FlipNone);
                break;

            case moveDirectionEnum.Down:
                BBIT.RotateFlip(RotateFlipType.RotateNoneFlipY);
                break;
            }
            #endregion
            removed  = false;
            checkVar = checkVarEnum.barNo;
            burstX   = 0; burstY = 0; burstDX = 16; burstDY = 16;
        }
Esempio n. 2
0
        int shootInterval;                                            //интервал между выстрелами вражеских танков

        public EnemyTank(int x, int y, int dx, int dy, moveDirectionEnum dir, tankTeam team)
            : base(x, y, dx, dy, dir, team)
        {
            if (team == tankTeam.enemy_rap || team == tankTeam.enemy_imba)
            {
                Speed = 4;
            }
            else
            {
                Speed = 2;
            }
            if (team == tankTeam.enemy_arm || team == tankTeam.enemy_imba)
            {
                hp = 3;
            }
            else
            {
                hp = 1;
            }
            if (team == tankTeam.enemy_rf || team == tankTeam.enemy_imba)
            {
                shootInterval = 15;
            }
            else
            {
                shootInterval = 40;
            }
            shootIter = 0;
            iterChDir = 0;
            #region выбор картинки
            switch (team)
            {
            case tankTeam.enemy_norm:
                TBIT = enemyNormBit;
                TBIT.RotateFlip(RotateFlipType.RotateNoneFlipY);
                break;

            case tankTeam.enemy_rap:
                TBIT = enemyRapBit;
                TBIT.RotateFlip(RotateFlipType.RotateNoneFlipY);
                break;

            case tankTeam.enemy_arm:
                TBIT = enemyArmBit;
                TBIT.RotateFlip(RotateFlipType.RotateNoneFlipY);
                break;

            case tankTeam.enemy_rf:
                TBIT = enemyRFBit;
                TBIT.RotateFlip(RotateFlipType.RotateNoneFlipY);
                break;

            case tankTeam.enemy_imba:
                TBIT = enemyImbBit;
                TBIT.RotateFlip(RotateFlipType.RotateNoneFlipY);
                break;
            }
            #endregion
        }
Esempio n. 3
0
        public bool immob;                                     //может ли свой танк двигаться

        public MyTank(int x, int y, int dx, int dy, moveDirectionEnum dir, tankTeam team)
            : base(x, y, dx, dy, dir, team)
        {
            Speed = 2;
            hp    = 3;
            shot  = true;
            TBIT  = MyTankBit;
        }
Esempio n. 4
0
 public Tank(int x, int y, int dx, int dy, moveDirectionEnum dir, tankTeam team)
 {
     this.x      = x;
     this.y      = y;
     this.dx     = dx;
     this.dy     = dy;
     ice         = false;
     this.dir    = dir;
     changeDir   = false;
     previousDir = dir;
     this.team   = team;
     removed     = false;
     checkVar    = checkVarEnum.barNo;
 }
Esempio n. 5
0
        public virtual void MoveTank() //движение танка
        {
            int iterX = x / 16;
            int iterY = y / 16;

            #region выравнивание по сетке (нужно, чтобы вписываться в повороты) и расчет новых координат
            if (dir == moveDirectionEnum.Left)
            {
                if (y % 16 != 0)
                {
                    if (y / 16.0 - iterY > iterY + 1 - y / 16.0)
                    {
                        y = (iterY + 1) * 16;
                    }
                    else
                    {
                        y = iterY * 16;
                    }
                }
                x -= Speed;
            }
            if (dir == moveDirectionEnum.Right)
            {
                if (y % 16 != 0)
                {
                    if (y / 16.0 - iterY > iterY + 1 - y / 16.0)
                    {
                        y = (iterY + 1) * 16;
                    }
                    else
                    {
                        y = iterY * 16;
                    }
                }
                x += Speed;
            }
            if (dir == moveDirectionEnum.Up)
            {
                if (x % 16 != 0)
                {
                    if (x / 16.0 - iterX > iterX + 1 - x / 16.0)
                    {
                        x = (iterX + 1) * 16;
                    }
                    else
                    {
                        x = iterX * 16;
                    }
                }
                y -= Speed;
            }
            if (dir == moveDirectionEnum.Down)
            {
                if (x % 16 != 0)
                {
                    if (x / 16.0 - iterX > iterX + 1 - x / 16.0)
                    {
                        x = (iterX + 1) * 16;
                    }
                    else
                    {
                        x = iterX * 16;
                    }
                }
                y += Speed;
            }
            #endregion

            //проверка на наличие препятствий
            if (checkVar == checkVarEnum.barLeft)
            {
                x += Speed;
            }
            if (checkVar == checkVarEnum.barRight)
            {
                x -= Speed;
            }
            if (checkVar == checkVarEnum.barUp)
            {
                y += Speed;
            }
            if (checkVar == checkVarEnum.barDown)
            {
                y -= Speed;
            }

            #region выбор картинки
            if (changeDir == true)
            {
                switch (dir)
                {
                //картинка поворачиватся с учетом предыдущего положения
                case moveDirectionEnum.Left:
                    switch (previousDir)
                    {
                    case moveDirectionEnum.Right:
                        TBIT.RotateFlip(RotateFlipType.RotateNoneFlipX);
                        break;

                    case moveDirectionEnum.Up:
                        TBIT.RotateFlip(RotateFlipType.Rotate270FlipNone);
                        break;

                    case moveDirectionEnum.Down:
                        TBIT.RotateFlip(RotateFlipType.Rotate90FlipNone);
                        break;
                    }
                    break;

                case moveDirectionEnum.Right:
                    switch (previousDir)
                    {
                    case moveDirectionEnum.Left:
                        TBIT.RotateFlip(RotateFlipType.RotateNoneFlipX);
                        break;

                    case moveDirectionEnum.Up:
                        TBIT.RotateFlip(RotateFlipType.Rotate90FlipNone);
                        break;

                    case moveDirectionEnum.Down:
                        TBIT.RotateFlip(RotateFlipType.Rotate270FlipNone);
                        break;
                    }
                    break;

                case moveDirectionEnum.Up:
                    switch (previousDir)
                    {
                    case moveDirectionEnum.Left:
                        TBIT.RotateFlip(RotateFlipType.Rotate90FlipNone);
                        break;

                    case moveDirectionEnum.Right:
                        TBIT.RotateFlip(RotateFlipType.Rotate270FlipNone);
                        break;

                    case moveDirectionEnum.Down:
                        TBIT.RotateFlip(RotateFlipType.RotateNoneFlipY);
                        break;
                    }
                    break;

                case moveDirectionEnum.Down:
                    switch (previousDir)
                    {
                    case moveDirectionEnum.Left:
                        TBIT.RotateFlip(RotateFlipType.Rotate270FlipNone);
                        break;

                    case moveDirectionEnum.Right:
                        TBIT.RotateFlip(RotateFlipType.Rotate90FlipNone);
                        break;

                    case moveDirectionEnum.Up:
                        TBIT.RotateFlip(RotateFlipType.RotateNoneFlipY);
                        break;
                    }
                    break;
                }
                changeDir   = false;
                previousDir = dir;
            }
            #endregion
        }