示例#1
0
        public static int GetPlayer_側面Sub()
        {
            bool touchSide_L = Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X - GameConsts.PLAYER_側面判定Pt_X, Game.I.Player.Y)).Tile.IsWall();
            bool touchSide_R = Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X + GameConsts.PLAYER_側面判定Pt_X, Game.I.Player.Y)).Tile.IsWall();

            return((touchSide_L ? 1 : 0) | (touchSide_R ? 2 : 0));
        }
示例#2
0
        protected override IEnumerable <bool> E_Draw()
        {
            double ySpeed = 0.0;

            const double GRAVITY     = 1.0;
            const double SPEED_Y_MAX = 8.0;

            for (; ;)
            {
                this.Y += ySpeed;

                ySpeed += GRAVITY;
                ySpeed  = Math.Min(ySpeed, SPEED_Y_MAX);

                if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X, this.Y))).Tile.IsGround())                 // ? 地面に落ちた。
                {
                    break;
                }

                DDDraw.DrawCenter(Ground.I.Picture.Teki_a01_Shit01, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);

                this.Crash = DDCrashUtils.Point(new D2Point(this.X, this.Y));

                yield return(true);
            }
        }
示例#3
0
        public static bool IsPlayer_脳天()
        {
            bool touchCeiling =
                Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X - GameConsts.PLAYER_脳天判定Pt_X, Game.I.Player.Y - GameConsts.PLAYER_脳天判定Pt_Y)).Tile.IsWall() ||
                Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X + GameConsts.PLAYER_脳天判定Pt_X, Game.I.Player.Y - GameConsts.PLAYER_脳天判定Pt_Y)).Tile.IsWall();

            return(touchCeiling);
        }
示例#4
0
        public static bool IsPlayer_接地()
        {
            bool touchGround =
                Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X - GameConsts.PLAYER_接地判定Pt_X, Game.I.Player.Y + GameConsts.PLAYER_接地判定Pt_Y)).Tile.IsWall() ||
                Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X + GameConsts.PLAYER_接地判定Pt_X, Game.I.Player.Y + GameConsts.PLAYER_接地判定Pt_Y)).Tile.IsWall();

            return(touchGround);
        }
示例#5
0
        private IEnumerable <bool> E_Run()
        {
            DDPicture[] pictures = new DDPicture[]
            {
                Ground.I.Picture.Teki_a02_Run01,
                Ground.I.Picture.Teki_a02_Run02,
                Ground.I.Picture.Teki_a02_Run03,
            };

            for (int frame = 0; ; frame++)
            {
                if (
                    30 < frame &&
                    this.Random.Real() <
                    (
                        DDUtils.GetDistance(new D2Point(Game.I.Player.X, Game.I.Player.Y), new D2Point(this.X, this.Y)) < 400.0 ?
                        0.0001 :
                        0.03
                    ))
                {
                    break;
                }

                if (this.Random.Real() < 0.05)
                {
                    this.FacingLeft = Game.I.Player.X < this.X;
                }

                if (this.FacingLeft)
                {
                    if (!Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - 30.0, this.Y + 20.0)).Tile.IsGround())
                    {
                        this.FacingLeft = false;
                    }
                }
                else
                {
                    if (!Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + 30.0, this.Y + 20.0)).Tile.IsGround())
                    {
                        this.FacingLeft = true;
                    }
                }

                const double SPEED = 6.0;

                this.X += this.FacingLeft ? -SPEED : SPEED;

                DDDraw.DrawBegin(pictures[frame / 6 % 3], this.X - DDGround.ICamera.X, this.Y - 32 - DDGround.ICamera.Y);
                DDDraw.DrawZoom_X(this.FacingLeft ? 1.0 : -1.0);
                DDDraw.DrawEnd();

                yield return(true);
            }
            this.WaitFrame = 0;
        }
示例#6
0
        /// <summary>
        /// 側面の接地判定を行う。
        /// 側面モード:
        /// -- 1 == 下段のみ
        /// -- 2 == 中段のみ
        /// -- 3 == 中段と下段
        /// -- 4 == 上段のみ
        /// -- 5 == 上段と下段
        /// -- 6 == 上段と中段
        /// -- 7 == 全て
        /// 判定値:
        /// -- 0 == 接地していない。
        /// -- 1 == 左側に接地している。
        /// -- 2 == 右側に接地している。
        /// -- 3 == 左右両方接地している。
        /// </summary>
        /// <param name="側面モード">側面モード</param>
        /// <returns>判定値</returns>
        public static int GetPlayer_側面(int 側面モード = 7)
        {
            bool touchSide_L =
                (側面モード & 4) != 0 && Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X - GameConsts.PLAYER_側面判定Pt_X, Game.I.Player.Y - GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall() ||
                (側面モード & 2) != 0 && Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X - GameConsts.PLAYER_側面判定Pt_X, Game.I.Player.Y)).Tile.IsWall() ||
                (側面モード & 1) != 0 && Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X - GameConsts.PLAYER_側面判定Pt_X, Game.I.Player.Y + GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall();

            bool touchSide_R =
                (側面モード & 4) != 0 && Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X + GameConsts.PLAYER_側面判定Pt_X, Game.I.Player.Y - GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall() ||
                (側面モード & 2) != 0 && Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X + GameConsts.PLAYER_側面判定Pt_X, Game.I.Player.Y)).Tile.IsWall() ||
                (側面モード & 1) != 0 && Game.I.Map.GetCell(GameCommon.ToTablePoint(Game.I.Player.X + GameConsts.PLAYER_側面判定Pt_X, Game.I.Player.Y + GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall();

            return((touchSide_L ? 1 : 0) | (touchSide_R ? 2 : 0));
        }
示例#7
0
        protected override IEnumerable <bool> E_Draw()
        {
            bool   falling = false;
            double ySpeed  = 0.0;

            const double GRAVITY     = 0.5;
            const double SPEED_Y_MAX = 8.0;

            for (; ;)
            {
                if (
                    this.Y < Game.I.Player.Y &&
                    Math.Abs(Game.I.Player.X - this.X) < 50.0
                    )
                {
                    falling = true;
                }

                if (falling)
                {
                    this.Y += ySpeed;

                    ySpeed += GRAVITY;
                    ySpeed  = Math.Min(ySpeed, SPEED_Y_MAX);

                    I2Point pt = GameCommon.ToTablePoint(new D2Point(this.X, this.Y));

                    if (Game.I.Map.GetCell(pt).Tile.IsGround())                     // ? 地面に落ちた。
                    {
                        this.DeadFlag = true;

                        DDGround.EL.Add(SCommon.Supplier(this.E_地面に落ちた(
                                                             pt.X * GameConsts.TILE_W + GameConsts.TILE_W / 2,
                                                             pt.Y * GameConsts.TILE_H - GameConsts.TILE_H / 2
                                                             )));

                        break;
                    }
                }

                DDDraw.DrawCenter(Ground.I.Picture.Stage02_Chip_g04_01, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);

                this.Crash = DDCrashUtils.Rect_CenterSize(new D2Point(this.X, this.Y), new D2Size(16, 32));

                yield return(true);
            }
        }
示例#8
0
        public static void DrawEnemy()
        {
            int cam_l = DDGround.ICamera.X;
            int cam_t = DDGround.ICamera.Y;
            int cam_r = cam_l + DDConsts.Screen_W;
            int cam_b = cam_t + DDConsts.Screen_H;

            I2Point lt = GameCommon.ToTablePoint(cam_l, cam_t);
            I2Point rb = GameCommon.ToTablePoint(cam_r, cam_b);

            for (int x = lt.X; x <= rb.X; x++)
            {
                for (int y = lt.Y; y <= rb.Y; y++)
                {
                    MapCell cell = Game.I.Map.GetCell(x, y);

                    if (cell.EnemyName != GameConsts.ENEMY_NONE)
                    {
                        int tileL = x * GameConsts.TILE_W;
                        int tileT = y * GameConsts.TILE_H;

                        DDDraw.SetAlpha(0.3);
                        DDDraw.SetBright(new I3Color(0, 128, 255));
                        DDDraw.DrawRect(
                            Ground.I.Picture.WhiteBox,
                            tileL - cam_l,
                            tileT - cam_t,
                            GameConsts.TILE_W,
                            GameConsts.TILE_H
                            );
                        DDDraw.Reset();

                        DDPrint.SetBorder(new I3Color(0, 128, 255));
                        DDPrint.SetDebug(tileL - cam_l, tileT - cam_t);
                        DDPrint.Print(cell.EnemyName);
                        DDPrint.Reset();
                    }
                }
            }
        }
示例#9
0
        private IEnumerable <bool> E_Jump(double jumpSpeed)
        {
            double ySpeed = -jumpSpeed;

            const double SPEED_X = 3.0;
            const double GRAVITY = 0.5;

            for (int frame = 0; frame < 5; frame++)
            {
                DDDraw.DrawBegin(Ground.I.Picture.Teki_a03_Jump02, this.X - DDGround.ICamera.X, this.Y - 16 - DDGround.ICamera.Y);
                DDDraw.DrawZoom_X(this.FacingLeft ? 1.0 : -1.0);
                DDDraw.DrawEnd();

                yield return(true);
            }
            for (int frame = 0; ; frame++)
            {
                if (this.FacingLeft)
                {
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - 20.0, this.Y)).Tile.IsWall())
                    {
                        this.FacingLeft = false;
                    }
                }
                else
                {
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + 20.0, this.Y)).Tile.IsWall())
                    {
                        this.FacingLeft = true;
                    }
                }
                if (
                    ySpeed < 0.0 &&                     // ? 上昇中
                    Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X, this.Y - 20.0)).Tile.IsWall()
                    )
                {
                    ySpeed = 0.0;
                }

                if (0.0 < ySpeed)                 // ? 降下中
                {
                    I2Point pt = GameCommon.ToTablePoint(this.X, this.Y + 30.0);

                    if (Game.I.Map.GetCell(pt).Tile.IsGround())
                    {
                        this.Y = pt.Y * GameConsts.TILE_H - GameConsts.TILE_H / 2;
                        break;
                    }
                }
                if (Game.I.Map.H * GameConsts.TILE_H + 50.0 < this.Y) // ? 画面下に十分出た。
                {
                    this.DeadFlag = true;                             // 消滅
                }

                this.X += this.FacingLeft ? -SPEED_X : SPEED_X;
                this.Y += ySpeed;

                ySpeed += GRAVITY;

                DDDraw.DrawBegin(Ground.I.Picture.Teki_a03_Jump03, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                DDDraw.DrawZoom_X(this.FacingLeft ? 1.0 : -1.0);
                DDDraw.DrawEnd();

                yield return(true);
            }
            this.WaitFrame = 0;
        }
示例#10
0
        public override void Draw()
        {
            if (Game.I.Player.DeadFrame != 0)             // ? プレイヤー死亡
            {
                int addcntmax = 1 + (Game.I.Player.DeadFrame * 5) / GameConsts.PLAYER_DEAD_FRAME_MAX;

                for (int addcnt = 0; addcnt < addcntmax; addcnt++)
                {
                    D2Point enemyPos = new D2Point(
                        DDGround.Camera.X - DDConsts.Screen_W / 2 + DDConsts.Screen_W * DDUtils.Random.Real() * 2,
                        DDGround.Camera.Y - DDConsts.Screen_H / 2 + DDConsts.Screen_H * DDUtils.Random.Real() * 2
                        );

                    //Game.I.Enemies.Add(new Enemy_Death(enemyPos));
                    Game.I.Enemies.Add(new Enemy_Meteor(enemyPos));
                }
            }
            //else if (20 < this.Frame && this.Random.Real() < Math.Min(0.2, this.Frame / 500.0))
            else if (
                20 < this.Frame &&
                this.Random.GetInt(Math.Max(5, 100 - this.Frame)) == 0                 // Frame == 0.0 -> NaN 注意
                )
            {
                for (int retry = 0; retry < 10; retry++)
                {
                    D2Point dotPos;

                    switch (this.発生領域)
                    {
                    case 2:
                        dotPos = new D2Point(
                            DDGround.ICamera.X + this.Random.GetInt(DDConsts.Screen_W),
                            DDGround.ICamera.Y + this.Random.GetInt(DDConsts.Screen_H / 2) + DDConsts.Screen_H / 2
                            );
                        break;

                    case 4:
                        dotPos = new D2Point(
                            DDGround.ICamera.X + this.Random.GetInt(DDConsts.Screen_W / 2),
                            DDGround.ICamera.Y + this.Random.GetInt(DDConsts.Screen_H)
                            );
                        break;

                    case 5:
                        dotPos = new D2Point(
                            DDGround.ICamera.X + this.Random.GetInt(DDConsts.Screen_W),
                            DDGround.ICamera.Y + this.Random.GetInt(DDConsts.Screen_H)
                            );
                        break;

                    case 6:
                        dotPos = new D2Point(
                            DDGround.ICamera.X + this.Random.GetInt(DDConsts.Screen_W / 2) + DDConsts.Screen_W / 2,
                            DDGround.ICamera.Y + this.Random.GetInt(DDConsts.Screen_H)
                            );
                        break;

                    case 8:
                        dotPos = new D2Point(
                            DDGround.ICamera.X + this.Random.GetInt(DDConsts.Screen_W),
                            DDGround.ICamera.Y + this.Random.GetInt(DDConsts.Screen_H / 2)
                            );
                        break;

                    default:
                        throw null;                                 // never
                    }

                    I2Point cellPos = GameCommon.ToTablePoint(dotPos);
                    MapCell cell    = Game.I.Map.GetCell(cellPos);

                    if (
                        !cell.IsDefault &&                                                                                             // ? 画面外ではない。
                        300.0 < DDUtils.GetDistance(new D2Point(dotPos.X, dotPos.Y), new D2Point(Game.I.Player.X, Game.I.Player.Y)) && // ? 近すぎない。
                        (cell.Kind == MapCell.Kind_e.WALL || cell.Kind == MapCell.Kind_e.DEATH)
                        )
                    {
                        if (cell.Kind == MapCell.Kind_e.WALL)
                        {
                            cell.Kind     = MapCell.Kind_e.DEATH;
                            cell.KindOrig = MapCell.Kind_e.WALL;
                        }

                        D2Point enemyPos = new D2Point(
                            cellPos.X * GameConsts.TILE_W + GameConsts.TILE_W / 2,
                            cellPos.Y * GameConsts.TILE_H + GameConsts.TILE_H / 2
                            );

                        Game.I.Enemies.Add(new Enemy_Death(enemyPos));
                        Game.I.Enemies.Add(new Enemy_Meteor(enemyPos));

                        break;
                    }
                }
            }
            this.Frame++;
        }
示例#11
0
        public static void DrawTiles()
        {
            int cam_l = DDGround.ICamera.X;
            int cam_t = DDGround.ICamera.Y;
            int cam_r = cam_l + DDConsts.Screen_W;
            int cam_b = cam_t + DDConsts.Screen_H;

            I2Point lt = GameCommon.ToTablePoint(cam_l, cam_t);
            I2Point rb = GameCommon.ToTablePoint(cam_r, cam_b);

            for (int x = lt.X; x <= rb.X; x++)
            {
                for (int y = lt.Y; y <= rb.Y; y++)
                {
                    MapCell cell  = Game.I.Map.GetCell(x, y);
                    I3Color color = new I3Color(0, 0, 0);
                    string  name  = "";

                    switch (cell.Kind)
                    {
                    case MapCell.Kind_e.EMPTY:
                        goto endDraw;

                    case MapCell.Kind_e.START:
                        color = new I3Color(0, 255, 0);
                        break;

                    case MapCell.Kind_e.GOAL:
                        color = new I3Color(0, 255, 255);
                        break;

                    case MapCell.Kind_e.WALL:
                        color = new I3Color(255, 255, 0);
                        break;

                    case MapCell.Kind_e.WALL_ENEMY_THROUGH:
                        color = new I3Color(255, 255, 0);
                        name  = "E通";
                        break;

                    case MapCell.Kind_e.DEATH:
                        color = new I3Color(255, 0, 0);
                        break;

                    default:
                        color = new I3Color(128, 128, 255);
                        name  = MapCell.Kine_e_Names[(int)cell.Kind];

                        if (name.Contains(':'))
                        {
                            name = name.Substring(0, name.IndexOf(':'));
                        }

                        if (name.Contains('/'))
                        {
                            name = name.Substring(name.IndexOf('/') + 1);
                        }

                        break;
                    }

                    {
                        int tileL = x * GameConsts.TILE_W;
                        int tileT = y * GameConsts.TILE_H;

                        DDDraw.SetBright(color);
                        DDDraw.DrawRect(
                            Ground.I.Picture.WhiteBox,
                            tileL - cam_l,
                            tileT - cam_t,
                            GameConsts.TILE_W,
                            GameConsts.TILE_H
                            );
                        DDDraw.Reset();

                        DDDraw.SetAlpha(0.1);
                        DDDraw.SetBright(new I3Color(0, 0, 0));
                        DDDraw.DrawRect(
                            Ground.I.Picture.WhiteBox,
                            tileL - cam_l,
                            tileT - cam_t,
                            GameConsts.TILE_W,
                            GameConsts.TILE_H / 2
                            );
                        DDDraw.Reset();

                        DDDraw.SetAlpha(0.2);
                        DDDraw.SetBright(new I3Color(0, 0, 0));
                        DDDraw.DrawRect(
                            Ground.I.Picture.WhiteBox,
                            tileL - cam_l,
                            tileT - cam_t,
                            GameConsts.TILE_W / 2,
                            GameConsts.TILE_H
                            );
                        DDDraw.Reset();

                        DDGround.EL.Add(() =>
                        {
                            DDPrint.SetBorder(new I3Color(0, 64, 64));
                            DDPrint.SetPrint(tileL - cam_l, tileT - cam_t);
                            DDPrint.DebugPrint(name);
                            DDPrint.Reset();

                            return(false);
                        });
                    }

endDraw:
                    ;
                }
            }
        }
示例#12
0
        protected override IEnumerable <bool> E_Draw()
        {
            double       R           = LevelToR(this.Level);       // 自弾半径
            const double X_ADD       = 8.0;                        // 横移動速度
            const double GRAVITY     = 0.8;                        // 重力加速度
            const double Y_ADD_MAX   = 19.0;                       // 落下最高速度
            double       Y_ADD_FIRST = Game.I.Player.YSpeed - 6.0; // 初期_縦移動速度
            const double K           = 0.98;                       // 跳ね返り係数

            double yAdd         = Y_ADD_FIRST;
            int    bouncedCount = 0;

            // 初期位置調整
            {
                this.X += R * (this.FacingLeft ? -1 : 1);
                this.Y -= R;
            }

            for (int frame = 0; ; frame++)
            {
                this.X += X_ADD * (this.FacingLeft ? -1 : 1);
                this.Y += yAdd;

                yAdd += GRAVITY;

                DDUtils.Minim(ref yAdd, Y_ADD_MAX);

                // 跳ね返り
                {
                    int xBounce = 0;
                    int yBounce = 0;

                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - R, this.Y)).Tile.IsWall())
                    {
                        xBounce += 3;
                    }
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + R, this.Y)).Tile.IsWall())
                    {
                        xBounce -= 3;
                    }
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X, this.Y - R)).Tile.IsWall())
                    {
                        yBounce += 3;
                    }
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X, this.Y + R)).Tile.IsWall())
                    {
                        yBounce -= 3;
                    }
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - R / Consts.ROOT_OF_2, this.Y - R / Consts.ROOT_OF_2)).Tile.IsWall())
                    {
                        xBounce += 2;
                        yBounce += 2;
                    }
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + R / Consts.ROOT_OF_2, this.Y - R / Consts.ROOT_OF_2)).Tile.IsWall())
                    {
                        xBounce -= 2;
                        yBounce += 2;
                    }
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - R / Consts.ROOT_OF_2, this.Y + R / Consts.ROOT_OF_2)).Tile.IsWall())
                    {
                        xBounce += 2;
                        yBounce -= 2;
                    }
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + R / Consts.ROOT_OF_2, this.Y + R / Consts.ROOT_OF_2)).Tile.IsWall())
                    {
                        xBounce -= 2;
                        yBounce -= 2;
                    }

                    DDUtils.ToRange(ref xBounce, -1, 1);
                    DDUtils.ToRange(ref yBounce, -1, 1);

                    bool bounced = xBounce != 0 || yBounce != 0;

                    if (bounced)
                    {
                        bouncedCount++;

                        if (20 <= bouncedCount)                         // ? 跳ね返り回数オーバー
                        {
                            //DDGround.EL.Add(SCommon.Supplier(Effects.FireBall爆発(this.X, this.Y)));
                            break;
                        }
                    }

                    if (xBounce == -1)
                    {
                        this.FacingLeft = true;
                    }
                    else if (xBounce == 1)
                    {
                        this.FacingLeft = false;
                    }

                    if (yBounce == -1)
                    {
                        if (0.0 < yAdd)
                        {
                            yAdd *= -K;
                        }
                    }
                    else if (yBounce == 1)
                    {
                        if (yAdd < 0.0)
                        {
                            yAdd *= -K;
                        }
                    }
                }

                DDDraw.DrawBegin(Ground.I.Picture2.陰陽玉, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                DDDraw.DrawSetSize(R * 2, R * 2);
                DDDraw.DrawRotate(frame / 10.0);
                DDDraw.DrawEnd();

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), R);

                yield return(!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), R));                // カメラから出たら消滅する。
            }
        }
示例#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));
            }
        }
示例#14
0
        protected override IEnumerable <bool> E_Draw()
        {
            const int SHOOTING_FRAME_MAX = 15;
            //const int SHOOTING_FRAME_MAX = 10; // old

            int shootingFrame = 0;             // 0 == 無効, 1~ == 射撃モーション (カウントダウン方式)

            // 梯子の中央に寄せる。
            // -- 複数箇所から new Attack_Ladder() されるので、ここでやるのが妥当
            Game.I.Player.X = GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, 0.0)).X *GameConsts.TILE_W + GameConsts.TILE_W / 2;

            for (int frame = 0; ; frame++)
            {
                if (AttackCommon.CamSlide())
                {
                    goto endPlayer;
                }

                if (DDInput.DIR_8.GetInput() == 0 && 1 <= DDInput.A.GetInput()) // ? 上ボタンを離して、ジャンプボタン押下
                {
                    if (1 <= DDInput.DIR_2.GetInput())                          // ? 下ボタン押下 -> ジャンプしない。
                    {
                        Game.I.Player.JumpFrame = 0;
                        Game.I.Player.JumpCount = 0;

                        Game.I.Player.YSpeed = 0.0;
                    }
                    else                     // ? 下ボタンを離している -> ジャンプする。
                    {
                        Game.I.Player.JumpFrame = 1;
                        Game.I.Player.JumpCount = 1;

                        Game.I.Player.YSpeed = GameConsts.PLAYER_ジャンプ初速度;
                    }

                    // スライディングさせないために滞空状態にする。
                    // -- 入力猶予を考慮して、大きい値を設定する。
                    Game.I.Player.AirborneFrame = SCommon.IMAX / 2;

                    break;
                }

                if (1 <= DDInput.DIR_4.GetInput())
                {
                    Game.I.Player.FacingLeft = true;
                }

                if (1 <= DDInput.DIR_6.GetInput())
                {
                    Game.I.Player.FacingLeft = false;
                }

                // 移動
                if (shootingFrame == 0)                 // 射撃モーション時は移動出来ない。
                {
                    const double SPEED   = 2.5;
                    const double 加速_RATE = 0.5;

                    bool moved = false;

                    if (1 <= DDInput.DIR_8.GetInput())
                    {
                        Game.I.Player.Y -= Math.Min(SPEED, DDInput.DIR_8.GetInput() * 加速_RATE);
                        moved            = true;
                    }
                    if (1 <= DDInput.DIR_2.GetInput())
                    {
                        Game.I.Player.Y += Math.Min(SPEED, DDInput.DIR_2.GetInput() * 加速_RATE);
                        moved            = true;
                    }

                    if (moved)
                    {
                        // none
                    }
                }

                bool 攻撃ボタンを押した瞬間撃つ = Ground.I.ショットのタイミング == Ground.ショットのタイミング_e.ショットボタンを押し下げた時;
                bool shot          = false;

                if (1 <= DDInput.B.GetInput())
                {
                    if (攻撃ボタンを押した瞬間撃つ && DDInput.B.GetInput() == 1)
                    {
                        Game.I.Player.Shoot(1);
                        shot = true;
                    }
                    Game.I.Player.ShotChargePCT++;
                    DDUtils.Minim(ref Game.I.Player.ShotChargePCT, 100);
                }
                else
                {
                    int level     = GameCommon.ShotChargePCTToLevel(Game.I.Player.ShotChargePCT);
                    int chargePct = Game.I.Player.ShotChargePCT;
                    Game.I.Player.ShotChargePCT = 0;

                    if (攻撃ボタンを押した瞬間撃つ ? 2 <= level : 1 <= chargePct)
                    {
                        Game.I.Player.Shoot(level);
                        shot = true;
                    }
                }
                if (shot)
                {
                    shootingFrame = SHOOTING_FRAME_MAX;
                }
                else
                {
                    DDUtils.CountDown(ref shootingFrame);
                }

                //AttackCommon.ProcPlayer_移動();
                //AttackCommon.ProcPlayer_Fall();
                //AttackCommon.ProcPlayer_側面();
                AttackCommon.ProcPlayer_脳天();

                if (AttackCommon.ProcPlayer_接地())
                {
                    Game.I.Player.JumpFrame = 0;
                    Game.I.Player.JumpCount = 0;

                    Game.I.Player.YSpeed = 0.0;

                    break;
                }

                // ? 梯子の下に出た。
                if (
                    Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, Game.I.Player.Y + GameConsts.TILE_H * 0))).Tile.GetKind() != Tile.Kind_e.LADDER &&
                    Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, Game.I.Player.Y + GameConsts.TILE_H * 1))).Tile.GetKind() != Tile.Kind_e.LADDER
                    )
                {
                    Game.I.Player.JumpFrame = 0;
                    Game.I.Player.JumpCount = 0;

                    Game.I.Player.YSpeed = 0.0;

                    break;
                }
endPlayer:

                DDPicture picture;
                double xZoom;

                if (1 <= shootingFrame)
                {
                    picture = Ground.I.Picture.Chara_A01_Climb_Attack;
                    xZoom   = Game.I.Player.FacingLeft ? -1.0 : 1.0;
                }
                else
                {
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(Game.I.Player.X, Game.I.Player.Y))).Tile.GetKind() == Tile.Kind_e.LADDER)
                    {
                        picture = Ground.I.Picture.Chara_A01_Climb[(int)Game.I.Player.Y / 20 % 2];
                    }
                    else
                    {
                        picture = Ground.I.Picture.Chara_A01_Climb_Top;
                    }

                    xZoom = 1.0;
                }

                double x = Game.I.Player.X;
                double y = Game.I.Player.Y;

                // 整数化
                x = (int)x;
                y = (int)y;

                DDDraw.SetTaskList(Game.I.Player.Draw_EL);
                DDDraw.DrawBegin(
                    picture,
                    x - DDGround.ICamera.X,
                    y - DDGround.ICamera.Y
                    );
                DDDraw.DrawZoom_X(xZoom);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                yield return(true);
            }
        }
示例#15
0
        protected override IEnumerable <bool> E_Draw()
        {
            // 薄い壁にくっついて撃つと、壁の向こうに射出されてしまうのを防ぐ
            {
                foreach (int xd in new int[] { 0, 20, 40 })
                {
                    foreach (int yd in new int[] { -10, 0, 10 })
                    {
                        if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X - xd * (this.FacingLeft ? -1 : 1), this.Y + yd))).Tile.IsWall())
                        {
                            DDGround.EL.Add(SCommon.Supplier(Effects.FireBall爆発(this.X, this.Y)));
                            goto endFunc;
                            //yield break;
                        }
                    }
                }
            }

            double yAdd         = 0.0;
            int    bouncedCount = 0;

            for (int frame = 0; ; frame++)
            {
                this.X += 8.0 * (this.FacingLeft ? -1 : 1);
                this.Y += yAdd;

                yAdd += 0.8;                   // += 重力加速度

                DDUtils.Minim(ref yAdd, 19.0); // 落下速度制限

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

                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X - R, this.Y)).Tile.IsWall())
                    {
                        this.FacingLeft = false;
                        bounced         = true;
                    }
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X + R, this.Y)).Tile.IsWall())
                    {
                        this.FacingLeft = true;
                        bounced         = true;
                    }
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X, this.Y - R)).Tile.IsWall() && yAdd < 0.0)
                    {
                        yAdd   *= -0.98;
                        bounced = true;
                    }
                    if (Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X, this.Y + R)).Tile.IsWall() && 0.0 < yAdd)
                    {
                        yAdd   *= -0.98;
                        bounced = true;

                        while (
                            !Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X, this.Y)).Tile.IsWall() &&
                            Game.I.Map.GetCell(GameCommon.ToTablePoint(this.X, this.Y + R)).Tile.IsWall()
                            )
                        {
                            this.Y--;
                        }
                    }

                    if (bounced)
                    {
                        bouncedCount++;

                        if (20 <= bouncedCount)                         // ? 跳ね返り回数オーバー
                        {
                            DDGround.EL.Add(SCommon.Supplier(Effects.FireBall爆発(this.X, this.Y)));
                            break;
                        }
                    }
                }

                DDDraw.DrawBegin(Ground.I.Picture2.FireBall[14 + frame % 7], this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                DDDraw.DrawZoom(0.25);
                DDDraw.DrawEnd();

                this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 20.0);

                yield return(!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y)));                // カメラから出たら消滅する。
            }

endFunc:
            ;
        }
示例#16
0
        protected override IEnumerable <bool> E_Draw()
        {
            const double CHARA_R = 20.0;

            double ySpeed = 0.0;

            for (; ;)
            {
                if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X - CHARA_R, this.Y))).Tile.IsWall())                 // ? 左側面接触
                {
                    this.FacingLeft = false;
                }
                if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X + CHARA_R, this.Y))).Tile.IsWall())                 // ? 右側面接触
                {
                    this.FacingLeft = true;
                }

                if (this.端から落ちない)
                {
                    const double 判定_X = 10.0;
                    const double 判定_Y = CHARA_R + 1.0;

                    if (!Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X - 判定_X, this.Y + 判定_Y))).Tile.IsWall())                     // ? 左下足場無し -> 引き返す。
                    {
                        this.FacingLeft = false;
                    }
                    if (!Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X + 判定_X, this.Y + 判定_Y))).Tile.IsWall())                     // ? 右下足場なし -> 引き返す。
                    {
                        this.FacingLeft = true;
                    }
                }

                const double X_SPEED     = 1.0;
                const double GRAVITY     = 0.5;
                const double Y_SPEED_MAX = 10.0;

                this.X += X_SPEED * (this.FacingLeft ? -1 : 1);
                this.Y += ySpeed;

                ySpeed += GRAVITY;
                ySpeed  = Math.Min(ySpeed, Y_SPEED_MAX);

                if (GameCommon.壁処理(ref this.X, ref this.Y, new D2Point[] { new D2Point(0.0, CHARA_R) }))
                {
                    ySpeed = 0.0;
                }

                if (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), CHARA_R * 1.2))
                {
                    // 暫定_描画
                    {
                        DDDraw.SetBright(new I3Color(64, 64, 255));
                        DDDraw.DrawBegin(Ground.I.Picture.WhiteCircle, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                        DDDraw.DrawSetSize(CHARA_R * 2, CHARA_R * 2);
                        DDDraw.DrawEnd();
                        DDDraw.Reset();

                        DDPrint.SetPrint((int)this.X - DDGround.ICamera.X, (int)this.Y - DDGround.ICamera.Y);
                        DDPrint.SetBorder(new I3Color(0, 0, 0));
                        DDPrint.Print("[ノコ◆コ_" + this.HP + "_" + (this.端から落ちない ? 1 : 0) + "]");
                        DDPrint.Reset();
                    }

                    this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), CHARA_R);
                }
                yield return(true);
            }
        }