Exemple #1
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 #2
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 #3
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 #4
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));
            }
        }