Exemple #1
0
        protected override IEnumerable <bool> E_Draw()
        {
            double axisX = this.X;

            for (int frame = 0; ; frame++)
            {
                this.X    = axisX + Math.Sin(this.Rot) * this.XRate;
                this.Y   += this.YAdd;
                this.Rot += this.RotAdd;

                EnemyCommon.Shoot(this, this.ShotType);

                int koma = frame / 7;
                koma %= 2;

                DDDraw.SetMosaic();
                DDDraw.DrawBegin(Ground.I.Picture2.D_PUMPKIN_00[koma], this.X, this.Y);
                DDDraw.DrawZoom(2.0);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X - 1.0, this.Y + 3.0), 30.0);

                yield return(!EnemyCommon.IsEvacuated(this));
            }
        }
Exemple #2
0
        public override void Draw()
        {
            if (Game.I.FreezeEnemy)
            {
                goto startDraw;
            }

            this.IRot += this.IRotSpeed;

            this.IRot += IROT_360;
            this.IRot %= IROT_360;

startDraw:
            double rot = this.IRot * (Math.PI * 2.0) / IROT_360;

            double x = this.X + Math.Cos(rot) * R;
            double y = this.Y + Math.Sin(rot) * R;

            if (!EnemyCommon.IsOutOfScreen_ForDraw(new D2Point(x - DDGround.Camera.X, y - DDGround.Camera.Y)))
            {
                //DDDraw.SetBright(new I3Color(32, 192, 32)); // old
                DDDraw.SetBright(Game.I.Map.Design.EnemyColor_Cookie);
                DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, SCommon.ToInt(x - DDGround.ICamera.X), SCommon.ToInt(y - DDGround.ICamera.Y));
                DDDraw.DrawSetSize(GameConsts.TILE_W, GameConsts.TILE_H);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Rect_CenterSize(new D2Point(x, y), new D2Size(GameConsts.TILE_W, GameConsts.TILE_H));

                Game.I.タイル接近_敵描画_Points.Add(new D2Point(x, y));
            }
        }
Exemple #3
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (int frame = 0; ; frame++)
            {
                const double AR = 0.99;
                const double ER = 1.01;

                if (frame < this.EvacuateFrame)
                {
                    DDUtils.Approach(ref this.X, this.TargetX, AR);
                    DDUtils.Approach(ref this.Y, this.TargetY, AR);
                }
                else
                {
                    this.X += this.EvacuateXAdd;
                    this.Y += this.EvacuateYAdd;

                    this.EvacuateXAdd *= ER;
                    this.EvacuateXAdd *= ER;
                }

                EnemyCommon.Shoot(this, this.ShotType);

                yield return(EnemyCommon.FairyDraw(this.Fairy));
            }
        }
Exemple #4
0
        protected override IEnumerable <bool> E_Draw()
        {
            double axisX = this.X;
            double axisY = this.Y;

            for (int frame = 0; ; frame++)
            {
                axisX += this.XAdd;
                axisY += this.YAdd;
                DDUtils.Approach(ref this.R, 0.0, this.RApproachingRate);
                this.Rot += this.RotAdd;

                this.X = axisX + Math.Cos(this.Rot) * this.R;
                this.Y = axisY + Math.Sin(this.Rot) * this.R;

                EnemyCommon.Shoot(this, this.ShotType);

                int koma = frame / 5;
                koma %= 2;

                DDDraw.SetMosaic();
                DDDraw.DrawBegin(Ground.I.Picture2.D_PUMPKIN_00_GRBA[koma], this.X, this.Y);
                DDDraw.DrawZoom(3.0);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y + 4.0), 45.0);

                yield return(!EnemyCommon.IsEvacuated(this));
            }
        }
Exemple #5
0
        protected override IEnumerable <bool> E_Draw()
        {
            double r;

            switch (this.TamaKind)
            {
            case EnemyCommon.TAMA_KIND_e.NORMAL: r = 8.0; break;

            case EnemyCommon.TAMA_KIND_e.BIG: r = 12.0; break;

            case EnemyCommon.TAMA_KIND_e.LARGE: r = 30.0; break;

            // TODO: その他の敵弾についてもここへ追加..

            default:
                throw null;                         // never
            }
            double xAdd;
            double yAdd;

            DDUtils.MakeXYSpeed(this.X, this.Y, Game.I.Player.X, Game.I.Player.Y, this.Speed, out xAdd, out yAdd);
            DDUtils.Rotate(ref xAdd, ref yAdd, this.Angle);

            DDPicture picture = EnemyCommon.GetTamaPicture(this.TamaKind, this.TamaColor);

            for (; ;)
            {
                this.X += xAdd;
                this.Y += yAdd;

                DDDraw.DrawCenter(picture, this.X, this.Y);

                if (this.AbsorbableWeapon != -1)                 // ? 吸収可能
                {
                    DDDraw.SetAlpha(0.5);
                    DDDraw.SetBright(0.0, 0.5, 1.0);
                    DDDraw.DrawBegin(Ground.I.Picture2.D_MAHOJIN_HAJIKE_00[5], this.X, this.Y);
                    DDDraw.DrawRotate(DDEngine.ProcFrame / 30.0);
                    DDDraw.DrawZoom(0.5);
                    DDDraw.DrawEnd();
                    DDDraw.Reset();

                    DDPrint.SetPrint((int)this.X, (int)this.Y);
                    DDPrint.SetBorder(new I3Color(0, 0, 100));
                    DDPrint.Print("[" + this.AbsorbableWeapon + "]");
                    DDPrint.Reset();
                }
                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), r);

                yield return(!EnemyCommon.IsEvacuated(this));
            }
        }
Exemple #6
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (int frame = 0; ; frame++)
            {
                this.TargetX += this.XAdd;
                this.TargetY += this.YAdd;

                DDUtils.Approach(ref this.X, this.TargetX, this.ApproachingRate);
                DDUtils.Approach(ref this.Y, this.TargetY, this.ApproachingRate);

                EnemyCommon.Shoot(this, this.ShotType);

                yield return(EnemyCommon.FairyDraw(this.Fairy));
            }
        }
Exemple #7
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                double xa;
                double ya;

                DDUtils.MakeXYSpeed(this.X, this.Y, Game.I.Player.X, Game.I.Player.Y, this.Speed, out xa, out ya);

                this.X += xa;
                this.Y += ya;

                EnemyCommon.Shoot(this, this.ShotType);

                yield return(EnemyCommon.FairyDraw(this.Fairy));
            }
        }
Exemple #8
0
        public override void Draw()
        {
            if (!EnemyCommon.IsOutOfScreen_ForDraw(this))
            {
                double p = Math.Sin(DDEngine.ProcFrame / 10.0 + this.X + this.Y) * 0.5 + 0.5;                 // color phaese

                DDDraw.SetBright(new I3Color(
                                     SCommon.ToInt(DDUtils.AToBRate(Game.I.Map.Design.EnemyColor_Death_A.R, Game.I.Map.Design.EnemyColor_Death_B.R, p)),
                                     SCommon.ToInt(DDUtils.AToBRate(Game.I.Map.Design.EnemyColor_Death_A.G, Game.I.Map.Design.EnemyColor_Death_B.G, p)),
                                     SCommon.ToInt(DDUtils.AToBRate(Game.I.Map.Design.EnemyColor_Death_A.B, Game.I.Map.Design.EnemyColor_Death_B.B, p))
                                     ));
                DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, SCommon.ToInt(this.X - DDGround.ICamera.X), SCommon.ToInt(this.Y - DDGround.ICamera.Y));
                DDDraw.DrawSetSize(GameConsts.TILE_W, GameConsts.TILE_H);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Rect_CenterSize(new D2Point(this.X, this.Y), new D2Size(GameConsts.TILE_W, GameConsts.TILE_H));

                //Game.I.タイル接近_敵描画_Points.Add(new D2Point(this.X, this.Y)); // 地形の一部なので、追加しない。
            }
        }
Exemple #9
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                if (this.TargetY < this.MaxY)
                {
                    this.TargetY += this.Speed;
                }
                else
                {
                    this.TargetX += this.Speed * this.XDir;
                }

                DDUtils.Approach(ref this.X, this.TargetX, this.ApproachingRate);
                DDUtils.Approach(ref this.Y, this.TargetY, this.ApproachingRate);

                EnemyCommon.Shoot(this, this.ShotType);

                yield return(EnemyCommon.FairyDraw(this.Fairy));
            }
        }
Exemple #10
0
        public override void Draw()
        {
            this.X += this.XSpeed;
            this.Y += this.YSpeed;

            if (this.Y < this.Highest_Y)
            {
                DDUtils.Approach(ref this.YSpeed, 重力加速度, 0.9);
            }
            this.YSpeed = Math.Min(落下最高速度, this.YSpeed);

            int ix = SCommon.ToInt(this.X);
            int iy = SCommon.ToInt(this.Y);

            Around a2 = new Around(ix, iy, 2);

            int xDirSign = 0;
            int yDirSign = 0;

            if (this.Y < this.Highest_Y + 24.0)             // ? 最高高度に近い
            {
                if (
                    a2.Table[0, 0].IsEnemyPataWall() ||
                    a2.Table[0, 1].IsEnemyPataWall()
                    )
                {
                    xDirSign++;
                }

                if (
                    a2.Table[1, 0].IsEnemyPataWall() ||
                    a2.Table[1, 1].IsEnemyPataWall()
                    )
                {
                    xDirSign--;
                }
            }
            else
            {
                if (
                    a2.Table[0, 0].IsEnemyPataWall() &&
                    a2.Table[0, 1].IsEnemyPataWall()
                    )
                {
                    xDirSign++;
                }

                if (
                    a2.Table[1, 0].IsEnemyPataWall() &&
                    a2.Table[1, 1].IsEnemyPataWall()
                    )
                {
                    xDirSign--;
                }
            }

            if (
                !a2.Table[0, 0].IsEnemyPataWall() && a2.Table[0, 1].IsEnemyPataWall() ||
                !a2.Table[1, 0].IsEnemyPataWall() && a2.Table[1, 1].IsEnemyPataWall()
                )
            {
                yDirSign = -1;
            }
            else if (
                a2.Table[0, 0].IsEnemyPataWall() &&
                a2.Table[1, 0].IsEnemyPataWall()
                )
            {
                yDirSign = 1;
            }
            else
            {
                this.YSpeed += 重力加速度;
            }

            if (xDirSign != 0)
            {
                this.XSpeed = Math.Abs(this.XSpeed) * xDirSign;
            }

            if (yDirSign != 0)
            {
                this.YSpeed = Math.Abs(this.YSpeed) * yDirSign;
            }

            if (!EnemyCommon.IsOutOfScreen_ForDraw(this))
            {
                //DDDraw.SetBright(new I3Color(192, 32, 32)); // old
                DDDraw.SetBright(Game.I.Map.Design.EnemyColor_Pata);
                DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, SCommon.ToInt(this.X - DDGround.ICamera.X), SCommon.ToInt(this.Y - DDGround.ICamera.Y));
                DDDraw.DrawSetSize(GameConsts.TILE_W, GameConsts.TILE_H);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Rect_CenterSize(new D2Point(this.X, this.Y), new D2Size(GameConsts.TILE_W, GameConsts.TILE_H));

                Game.I.タイル接近_敵描画_Points.Add(new D2Point(this.X, this.Y));
            }
        }
Exemple #11
0
 protected override void Killed()
 {
     EnemyCommon.Killed(this, this.DropItemMode);
     Game.I.Score += 2000;
 }
Exemple #12
0
 protected override void Killed()
 {
     EnemyCommon.Killed(this, 0);
 }
Exemple #13
0
        public override void Draw()
        {
            if (Game.I.FreezeEnemy)
            {
                goto startDraw;
            }

            this.X += this.Speed * this.XAddSign;
            this.Y += this.Speed * this.YAddSign;

            // 跳ね返り
            {
                const double R       = 15.5;
                bool         bounced = false;

                if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - R, this.Y)).IsEnemyWall())
                {
                    this.XAddSign = 1;
                    bounced       = true;
                }
                else if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + R, this.Y)).IsEnemyWall())
                {
                    this.XAddSign = -1;
                    bounced       = true;
                }

                if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X, this.Y - R)).IsEnemyWall())
                {
                    this.YAddSign = 1;
                    bounced       = true;
                }
                else if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X, this.Y + R)).IsEnemyWall())
                {
                    this.YAddSign = -1;
                    bounced       = true;
                }

                if (!bounced && this.XAddSign * this.YAddSign != 0)                                        // ? まだ跳ね返っていない && 斜め -> 角に衝突した場合を処理
                {
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - R, this.Y - R)).IsEnemyWall()) // ? 左上に衝突
                    {
                        this.XAddSign = 1;
                        this.YAddSign = 1;
                        bounced       = true;
                    }
                    else if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + R, this.Y - R)).IsEnemyWall())                     // ? 右上に衝突
                    {
                        this.XAddSign = -1;
                        this.YAddSign = 1;
                        bounced       = true;
                    }
                    else if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - R, this.Y + R)).IsEnemyWall())                     // ? 左下に衝突
                    {
                        this.XAddSign = 1;
                        this.YAddSign = -1;
                        bounced       = true;
                    }
                    else if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + R, this.Y + R)).IsEnemyWall())                     // ? 右下に衝突
                    {
                        this.XAddSign = -1;
                        this.YAddSign = -1;
                        bounced       = true;
                    }
                }

                if (bounced)
                {
                    double mid_x = (int)(this.X / GameConsts.TILE_W) * GameConsts.TILE_W + GameConsts.TILE_W / 2;
                    double mid_y = (int)(this.Y / GameConsts.TILE_H) * GameConsts.TILE_H + GameConsts.TILE_H / 2;

                    double dif_x = Math.Abs(this.X - mid_x);
                    double dif_y = Math.Abs(this.Y - mid_y);

                    this.X = mid_x + dif_x * this.XAddSign;
                    this.Y = mid_y + dif_y * this.YAddSign;
                }
            }

startDraw:
            if (!EnemyCommon.IsOutOfScreen_ForDraw(this))
            {
                //DDDraw.SetBright(new I3Color(150, 100, 200)); // old
                DDDraw.SetBright(Game.I.Map.Design.EnemyColor_Arkanoid);
                DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, SCommon.ToInt(this.X - DDGround.ICamera.X), SCommon.ToInt(this.Y - DDGround.ICamera.Y));
                DDDraw.DrawSetSize(GameConsts.TILE_W, GameConsts.TILE_H);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Rect_CenterSize(new D2Point(this.X, this.Y), new D2Size(GameConsts.TILE_W, GameConsts.TILE_H));

                Game.I.タイル接近_敵描画_Points.Add(new D2Point(this.X, this.Y));
            }
        }
Exemple #14
0
 /// <summary>
 /// 自弾(プレイヤーの弾)によってダメージを受けた時に呼び出される。
 /// 撃破された時は呼ばれない。
 /// -- 1撃で倒された場合、1度も呼び出されないことになる。
 /// </summary>
 public virtual void Damaged()
 {
     EnemyCommon.Damaged(this);
 }