Example #1
0
        public int InvincibleFrame = 0;   // 0 == 無効, 0< == 無敵時間中

        public void Draw()
        {
            if (1 <= this.RebornFrame)
            {
                DDDraw.SetAlpha(0.5);
                DDDraw.DrawCenter(Ground.I.Picture.Player, this.Reborn_X, this.Reborn_Y);
                DDDraw.Reset();

                return;
            }
            if (1 <= this.DeadFrame)
            {
                // noop // 描画は Game.Perform で行う。

                return;
            }
            if (1 <= this.InvincibleFrame)
            {
                DDDraw.SetAlpha(0.5);
                DDDraw.DrawCenter(Ground.I.Picture.Player, this.X, this.Y);
                DDDraw.Reset();

                return;
            }
            DDDraw.DrawCenter(Ground.I.Picture.Player, this.X, this.Y);
        }
Example #2
0
            private IEnumerable <bool> E_DrawItem(int selfIndex)
            {
                DDPicture picture = Ground.I.Picture2.TitleMenuItem[0, selfIndex];

                const double ITEM_UNSEL_X = 120.0;
                const double ITEM_UNSEL_A = 0.5;
                const double ITEM_SEL_X   = 140.0;
                const double ITEM_SEL_A   = 1.0;
                const double ITEM_Y       = 195.0;
                const double ITEM_Y_STEP  = 50.0;

                double x     = ITEM_SEL_X;
                double y     = ITEM_Y + selfIndex * ITEM_Y_STEP;
                double a     = ITEM_UNSEL_A;
                double realX = -100.0 - selfIndex * 200.0;
                double realY = y;
                double realA = a;

                for (; ;)
                {
                    x = this.SelectIndex == selfIndex ? ITEM_SEL_X : ITEM_UNSEL_X;
                    a = this.SelectIndex == selfIndex ? ITEM_SEL_A : ITEM_UNSEL_A;

                    DDUtils.Approach(ref realX, x, 0.93);
                    DDUtils.Approach(ref realA, a, 0.93);

                    DDDraw.SetAlpha(realA);
                    DDDraw.DrawCenter(picture, realX, realY);
                    DDDraw.Reset();

                    yield return(true);
                }
            }
Example #3
0
        /// <summary>
        /// NG !!!
        /// </summary>
        public void Test03()
        {
            const int DER_WH = 60;
            const int DERS_W = 16;
            const int DERS_H = 9;

            DDPicture wallPicture = DDCCResource.GetPicture(@"dat\テスト用\IMG_20160000_000040.jpg");

            DDSubScreen screen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H);

            DDPicture[,] ders = DDDerivations.GetAnimation(screen.ToPicture(), 0, 0, DERS_W, DERS_H, DER_WH, DER_WH);

            for (; ;)
            {
                using (screen.Section())
                {
                    DDDraw.DrawCenter(wallPicture, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                }

                for (int x = 0; x < DERS_W; x++)
                {
                    for (int y = 0; y < DERS_H; y++)
                    {
                        DDDraw.DrawRect(ders[x, y], x * DER_WH, y * DER_WH, (x + 1) * DER_WH, (y + 1) * DER_WH);
                    }
                }

                DDEngine.EachFrame();
            }
        }
Example #4
0
                public override IEnumerable <bool> E_Task()
                {
                    DDPicture picture = new DDPicture[]
                    {
                        Ground.I.Picture.TitleMenuItem_はじめから,
                        Ground.I.Picture.TitleMenuItem_つづきから,
                        Ground.I.Picture.TitleMenuItem_設定,
                        Ground.I.Picture.TitleMenuItem_終了,
                    }
                    [this.SelfIndex];

                    double targX = ITEM_X;
                    double targA = ITEM_A;

                    double x = targX;
                    double y = ITEM_Y + this.SelfIndex * ITEM_Y_STEP;
                    double a = targA;

                    for (; ;)
                    {
                        targX = TitleMenu.I.TopMenu.SelectIndex == this.SelfIndex ? ITEM_SEL_X : ITEM_X;
                        targA = TitleMenu.I.TopMenu.SelectIndex == this.SelfIndex ? ITEM_SEL_A : ITEM_A;

                        DDUtils.Approach(ref x, targX, 0.93);
                        DDUtils.Approach(ref a, targA, 0.93);

                        DDDraw.SetAlpha(a);
                        DDDraw.DrawCenter(picture, x, y);
                        DDDraw.Reset();

                        this.Selected = !DDUtils.IsOut(new D2Point(DDMouse.X, DDMouse.Y), new D4Rect(ITEM_X - ITEM_W / 2, y - ITEM_H / 2, ITEM_W, ITEM_H));

                        yield return(true);
                    }
                }
Example #5
0
                public override IEnumerable <bool> E_Task()
                {
                    DDPicture picture = Ground.I.Picture.TitleMenuItems[this.SelfIndex];

                    double targX = ITEM_UNSEL_X;
                    double targA = ITEM_UNSEL_A;

                    double x = targX;
                    double y = ITEM_Y + this.SelfIndex * ITEM_Y_STEP;
                    double a = targA;

                    for (; ;)
                    {
                        targX = TitleMenu.I.TopMenu.SelectIndex == this.SelfIndex ? ITEM_SEL_X : ITEM_UNSEL_X;
                        targA = TitleMenu.I.TopMenu.SelectIndex == this.SelfIndex ? ITEM_SEL_A : ITEM_UNSEL_A;

                        DDUtils.Approach(ref x, targX, 0.93);
                        DDUtils.Approach(ref a, targA, 0.93);

                        DDDraw.SetAlpha(a);
                        DDDraw.DrawCenter(picture, x, y);
                        DDDraw.Reset();

                        yield return(true);
                    }
                }
Example #6
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);
            }
        }
Example #7
0
 public override void Draw(double draw_x, double draw_y, int map_x, int map_y)
 {
     DDGround.EL.Add(() =>
     {
         DDDraw.DrawCenter(this.Picture, draw_x, draw_y);
         return(false);
     });
 }
Example #8
0
 public override void Draw(double draw_x, double draw_y, int map_x, int map_y)
 {
     DDGround.EL.Add(() =>
     {
         DDDraw.DrawCenter(this.Pictures[DDEngine.ProcFrame / 4 % 4], draw_x, draw_y);
         return(false);
     });
 }
Example #9
0
        /// <summary>
        /// throws Cancelled
        /// </summary>
        public static void Perform()
        {
            DDUtils.SetMouseDispMode(true);

            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain(10);

            foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                DDDraw.DrawSimple(Ground.I.Picture.箱から出る_背景, 0, 0);
                DDDraw.DrawCenter(Ground.I.Picture.箱から出る_箱0001, DDConsts.Screen_W / 2, DDConsts.Screen_H - Ground.I.Picture.箱から出る_箱0001.Get_H() / 2);

                P_EachFrame();
            }
            for (int c = 0; c < 2; c++)
            {
                foreach (DDScene scene in DDSceneUtils.Create(30))
                {
                    double x = DDConsts.Screen_W / 2;
                    double y = DDConsts.Screen_H - Ground.I.Picture.箱から出る_箱0001.Get_H() / 2;

                    //double buruSpan = 20.0 * (1.0 - scene.Rate) + 10.0;
                    double buruSpan = 30.0 * (1.0 - scene.Rate);
                    double xBuru    = DDUtils.Random.Real() * buruSpan - buruSpan / 2;
                    double yBuru    = DDUtils.Random.Real() * buruSpan;
                    double z        = 1.0 + 0.2 * (1.0 - scene.Rate);

                    DDDraw.DrawSimple(Ground.I.Picture.箱から出る_背景, 0, 0);
                    DDDraw.DrawBegin(Ground.I.Picture.箱から出る_箱0001, x + xBuru, y + yBuru);
                    DDDraw.DrawZoom(z);
                    DDDraw.DrawEnd();

                    P_EachFrame();
                }
            }
            foreach (DDScene scene in DDSceneUtils.Create(50))
            {
                if (scene.Numer == 30)
                {
                    DDCurtain.SetCurtain(20, -1.0);
                }

                double x = DDConsts.Screen_W / 2;
                double y = DDConsts.Screen_H - Ground.I.Picture.箱から出る_箱0002.Get_H() / 2;

                double zure  = scene.Rate * 10.0;
                double xZure = zure;
                double yZure = zure;
                double z     = 1.0 + 0.1 * (1.0 - scene.Rate);

                DDDraw.DrawSimple(Ground.I.Picture.箱から出る_背景, 0, 0);
                DDDraw.DrawBegin(Ground.I.Picture.箱から出る_箱0002, x + xZure, y + yZure);
                DDDraw.DrawZoom(z);
                DDDraw.DrawEnd();

                P_EachFrame();
            }
        }
Example #10
0
        protected override IEnumerable <bool> E_Draw()
        {
            while (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y)))
            {
                this.X += 12.0 * (this.FacingLeft ? -1 : 1);

                switch (this.Level)
                {
                case 1:
                {
                    DDDraw.DrawCenter(Ground.I.Picture.Shot_Normal, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);

                    this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 10.0);
                }
                break;

                case 2:
                {
                    const double R = 14.0;

                    DDDraw.DrawBegin(Ground.I.Picture.WhiteCircle, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                    DDDraw.DrawSetSize(R, R);
                    DDDraw.DrawEnd();

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

                case 3:
                {
                    const double R = 24.0;

                    DDDraw.DrawBegin(Ground.I.Picture.WhiteCircle, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                    DDDraw.DrawSetSize(R, R);
                    DDDraw.DrawEnd();

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

                case 4:
                {
                    const double R = 48.0;

                    DDDraw.DrawBegin(Ground.I.Picture.WhiteCircle, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                    DDDraw.DrawSetSize(R, R);
                    DDDraw.DrawEnd();

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

                default:
                    throw null;                             // never
                }
                yield return(true);
            }
        }
Example #11
0
 protected override IEnumerable <bool> E_Draw()
 {
     for (; ;)
     {
         this.X -= 3.0;
         DDDraw.DrawCenter(Ground.I.Picture.Enemy0001, this.X, this.Y);
         this.Crash = DDCrashUtils.Circle(new D2Point(this.X, this.Y), 48.0);
         yield return(!DDUtils.IsOutOfScreen(new D2Point(this.X, this.Y), 48.0));
     }
 }
Example #12
0
        public void Draw()
        {
            int koma = 1;

            if (1 <= this.MoveFrame)
            {
                koma = (Game.I.Frame / 5) % 4;

                if (koma == 3)
                {
                    koma = 1;
                }
            }

            DDPicture picture;

            var infos = new[]
            {
                null,
                new { Pic = Ground.I.Picture2.Player_05, Y = 0 },                 // 1 (左下向き)
                new { Pic = Ground.I.Picture2.Player_00, Y = 0 },                 // 2 (下向き)
                new { Pic = Ground.I.Picture2.Player_05, Y = 2 },                 // 3 (右下向き)
                new { Pic = Ground.I.Picture2.Player_00, Y = 1 },                 // 4 (左向き)
                null,
                new { Pic = Ground.I.Picture2.Player_00, Y = 2 },                 // 6 (右向き)
                new { Pic = Ground.I.Picture2.Player_05, Y = 1 },                 // 7 (左上向き)
                new { Pic = Ground.I.Picture2.Player_00, Y = 3 },                 // 8 (上向き)
                new { Pic = Ground.I.Picture2.Player_05, Y = 3 },                 // 9 (右上向き)
            };

            var info = infos[this.FaceDirection];

            picture = info.Pic[koma, info.Y];

            // ---- ダメージ中等差し替え ----

            if (1 <= this.DeadFrame)
            {
                picture = Ground.I.Picture2.Player_02[0, 3];
            }
            else if (1 <= this.DamageFrame || 1 <= this.InvincibleFrame)
            {
                DDDraw.SetTaskList(DDGround.EL);
                DDDraw.SetAlpha(0.5);
            }

            // ----

            DDDraw.DrawCenter(
                picture,
                (int)this.X - DDGround.ICamera.X,
                (int)this.Y - DDGround.ICamera.Y
                );
            DDDraw.Reset();
        }
Example #13
0
        public void Test04()
        {
            const int DER_WH = 60;
            const int DERS_W = 16;
            const int DERS_H = 9;

            DDPicture wallPicture = DDCCResource.GetPicture(@"dat\テスト用\IMG_20160000_000040.jpg");

            DDSubScreen screen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H);

            DDSubScreen[,] ders = new DDSubScreen[DERS_W, DERS_H];

            for (int x = 0; x < DERS_W; x++)
            {
                for (int y = 0; y < DERS_H; y++)
                {
                    ders[x, y] = new DDSubScreen(DER_WH, DER_WH);
                }
            }

            for (; ;)
            {
                DDDraw.DrawCenter(wallPicture, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);

                for (int x = 0; x < DERS_W; x++)
                {
                    for (int y = 0; y < DERS_H; y++)
                    {
                        using (ders[x, y].Section())
                            DX.DrawRectGraph(0, 0, x * DER_WH, y * DER_WH, (x + 1) * DER_WH, (y + 1) * DER_WH, DDGround.MainScreen.GetHandle(), 0);
                    }
                }

                using (screen.Section())
                {
                    for (int x = 0; x < DERS_W; x++)
                    {
                        for (int y = 0; y < DERS_H; y++)
                        {
                            DDDraw.DrawFree(
                                ders[x, y].ToPicture(),
                                new D2Point((x + 0) * DER_WH, (y + 0) * DER_WH),
                                new D2Point((x + 1) * DER_WH, (y + 0) * DER_WH),
                                new D2Point((x + 1) * DER_WH, (y + 1) * DER_WH),
                                new D2Point((x + 0) * DER_WH, (y + 1) * DER_WH)
                                );
                        }
                    }
                }

                DDDraw.DrawSimple(screen.ToPicture(), 0, 0);

                DDEngine.EachFrame();
            }
        }
Example #14
0
        private void DrawDungeon(double xSlideRate = 0.0)
        {
            DDDraw.DrawCenter(DungeonScreen.DungScreen.ToPicture(), DDConsts.Screen_W / 2 + xSlideRate * 90.0, DDConsts.Screen_H / 2 - 150);             // kari

            // 仮枠線
            DDDraw.SetBright(0, 0, 0);
            DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, 0, 85, DDConsts.Screen_H);
            DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, DDConsts.Screen_W - 85, 0, 85, DDConsts.Screen_H);
            DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, 0, DDConsts.Screen_W, 10);
            DDDraw.Reset();
        }
Example #15
0
        private static void BigFairyDraw(FairyInfo fairy, int color)
        {
            if (fairy.Frame == 0)             // init
            {
                fairy.LastX = fairy.Enemy.X;
            }
            double xDiff = fairy.Enemy.X - fairy.LastX;

            fairy.LastX = fairy.Enemy.X;

            if (fairy.Frame % 7 == 0)
            {
                if (Math.Abs(xDiff) < SCommon.MICRO)                 // ? 左右に動いてない。
                {
                    DDUtils.CountDown(ref fairy.XMoveCount);
                }
                else if (xDiff < 0.0)                 // ? 左に動いてる。
                {
                    fairy.XMoveCount--;
                }
                else                 // ? 右に動いてる。
                {
                    fairy.XMoveCount++;
                }
                DDUtils.ToRange(ref fairy.XMoveCount, -2, 2);
            }
            int mode = DDUtils.Sign(fairy.XMoveCount);
            int koma;

            if (mode != 0)
            {
                koma = Math.Abs(fairy.XMoveCount) - 1;
            }
            else
            {
                koma = (fairy.Frame / 7) % 3;
            }

            if (1 <= fairy.Enemy.HP && fairy.Enemy.TransFrame == 0)             // ? 無敵ではない。
            {
                DDUtils.Approach(ref fairy.UntransRate, 0.5, 0.92);
            }

            DDDraw.SetAlpha(fairy.UntransRate);
            DDDraw.DrawBegin(Ground.I.Picture2.D_MAHOJIN_HAJIKE_00[5], fairy.Enemy.X, fairy.Enemy.Y);
            DDDraw.DrawRotate(fairy.Frame / 20.0);
            DDDraw.DrawZoom(0.4);
            DDDraw.DrawEnd();
            DDDraw.Reset();

            DDDraw.DrawCenter(GetBigFairyPicture(color, mode, koma), fairy.Enemy.X, fairy.Enemy.Y);

            fairy.Enemy.Crash = DDCrashUtils.Circle(new D2Point(fairy.Enemy.X, fairy.Enemy.Y), 30.0);
        }
Example #16
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                DDDraw.DrawCenter(this.Picture, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);

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

                yield return(true);
            }
        }
Example #17
0
        public static IEnumerable <bool> 中爆発(double x, double y)
        {
            foreach (DDPicture picture in Ground.I.Picture.Effect_A01_B_Explosion)
            {
                for (int c = 0; c < 4; c++)
                {
                    DDDraw.DrawCenter(picture, x - DDGround.ICamera.X, y - DDGround.ICamera.Y);

                    yield return(true);
                }
            }
        }
Example #18
0
        public static IEnumerable <bool> ヒットバック(double x, double y)
        {
            foreach (DDPicture picture in Ground.I.Picture.Effect_A01_Shock_B)
            {
                for (int c = 0; c < 6; c++)
                {
                    DDDraw.DrawCenter(picture, x - DDGround.ICamera.X, y - DDGround.ICamera.Y);

                    yield return(true);
                }
            }
        }
Example #19
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));
            }
        }
Example #20
0
        private void DrawTrackBar(int x, int y, string lwLabel, string hiLabel, double rate, Action <double> changed, Action pulse = null)
        {
            DDDraw.DrawBegin(Ground.I.Picture.TrackBar, x, y);
            DDCrash drawedCrash = DDDraw.DrawGetCrash();

            DDDraw.DrawEnd();

            DDPrint.SetPrint(x - Ground.I.Picture.TrackBar.Get_W() / 2 - lwLabel.Length * 32, y - 15);
            DDPrint.Print(lwLabel);

            DDPrint.SetPrint(x + Ground.I.Picture.TrackBar.Get_W() / 2, y - 15);
            DDPrint.Print(hiLabel);

            double span = Ground.I.Picture.TrackBar.Get_W() - Ground.I.Picture.TrackBar_つまみ.Get_W();

            span /= 2;
            double xMin = x - span;
            double xMax = x + span;

            double xつまみ = DDUtils.AToBRate(xMin, xMax, rate);

            DDDraw.DrawCenter(Ground.I.Picture.TrackBar_つまみ, xつまみ, y);

            if (drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
            {
                this.LastHoveringTrackBar = drawedCrash;
            }
            if (
                this.LastActiveTrackBar != null &&
                this.LastActiveTrackBar.Value.IsCrashed(DDCrashUtils.Point(new D2Point(x, y)))
                )
            {
                double rateNew = DDUtils.RateAToB(xMin, xMax, DDMouse.X);
                DDUtils.ToRange(ref rateNew, 0.0, 1.0);

                if (SCommon.MICRO < Math.Abs(rate - rateNew))
                {
                    changed(rateNew);
                }

                if (pulse != null)
                {
                    const int PULSE_FRM = 60;

                    if (DDEngine.ProcFrame % PULSE_FRM == 0)
                    {
                        pulse();
                    }
                }
            }
        }
Example #21
0
        private void DrawWall(DDPicture picture, I3Color color, double xRate, double yRate)
        {
            int xSpan = picture.Get_W() - DDConsts.Screen_W;
            int ySpan = picture.Get_H() - DDConsts.Screen_H;
            int span  = Math.Min(xSpan, ySpan);

            DDDraw.SetBright(color);
            DDDraw.DrawCenter(
                picture,
                DDConsts.Screen_W / 2 - (xRate - 0.5) * span,
                DDConsts.Screen_H / 2 - (yRate - 0.5) * span
                );
            DDDraw.Reset();
        }
Example #22
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                this.X += 10;

                DDDraw.SetAlpha(0.5);
                DDDraw.DrawCenter(Ground.I.Picture.Shot0001, this.X, this.Y);
                DDDraw.Reset();

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

                yield return(!DDUtils.IsOutOfScreen(new D2Point(this.X, this.Y), 16.0));
            }
        }
Example #23
0
        protected override IEnumerable <bool> E_Draw()
        {
            D2Point speed = DDUtils.AngleToPoint(DDUtils.GetAngle(Game.I.Player.X - this.X, Game.I.Player.Y - this.Y), 8.0);

            for (; ;)
            {
                this.X += speed.X;
                this.Y += speed.Y;

                DDDraw.DrawCenter(Ground.I.Picture.Tama0001, this.X, this.Y);

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

                yield return(!DDUtils.IsOutOfScreen(new D2Point(this.X, this.Y), 16.0));
            }
        }
Example #24
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (int frame = 0; ; frame++)
            {
                this.X += this.Speed.X;
                this.Y += this.Speed.Y;

                if (this.X < 0.0)
                {
                    this.Speed.X = Math.Abs(this.Speed.X);
                }
                else if (GameConsts.FIELD_W < this.X)
                {
                    this.Speed.X = -Math.Abs(this.Speed.X);
                }

                if (this.Y < 0.0)
                {
                    this.Speed.Y = Math.Abs(this.Speed.Y);
                }
                else
                {
                    this.Speed.Y += 0.03;                     // 重力加速度
                }
                if (this.AbsorbableWeapon != -1)              // ? 吸収可能
                {
                    DDDraw.SetAlpha(0.2);
                    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(1.2);
                    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();
                }

                DDDraw.DrawCenter(EnemyCommon.GetTamaPicture(EnemyCommon.TAMA_KIND_e.DOUBLE, this.Color), this.X, this.Y);

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

                yield return(this.Y < GameConsts.FIELD_H);
            }
        }
Example #25
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);
            }
        }
Example #26
0
        public static IEnumerable <bool> 自弾跳ね返し(Shot shot)
        {
            double x  = shot.X;
            double y  = shot.Y;
            double xa = 8.0 * (shot.FacingLeft ? 1 : -1);
            double ya = -8.0;

            for (; ;)
            {
                x += xa;
                y += ya;

                DDDraw.DrawCenter(Ground.I.Picture.Shot_Normal, x - DDGround.ICamera.X, y - DDGround.ICamera.Y);

                yield return(true);
            }
        }
Example #27
0
        private void DrawMap()
        {
            int w = this.Map.W;
            int h = this.Map.H;

            int camL = DDGround.ICamera.X;
            int camT = DDGround.ICamera.Y;
            int camR = camL + DDConsts.Screen_W;
            int camB = camT + DDConsts.Screen_H;

            I2Point lt = Map.ToTablePoint(camL, camT);
            I2Point rb = Map.ToTablePoint(camR, camB);

            lt.X -= 2;             // margin
            lt.Y -= 2;             // margin
            rb.X += 2;             // margin
            rb.Y += 2;             // margin

            lt.X = IntTools.ToRange(lt.X, 0, w - 1);
            lt.Y = IntTools.ToRange(lt.Y, 0, h - 1);
            rb.X = IntTools.ToRange(rb.X, 0, w - 1);
            rb.Y = IntTools.ToRange(rb.Y, 0, h - 1);

            for (int x = lt.X; x <= rb.X; x++)
            {
                for (int y = lt.Y; y <= rb.Y; y++)
                {
                    int mapTileX = x * MapTile.WH + MapTile.WH / 2;
                    int mapTileY = y * MapTile.WH + MapTile.WH / 2;

                    //if (DDUtils.IsOut(new D2Point(mapTileX, mapTileY), new D4Rect(camL, camT, camR, camB), MapTile.WH * 2) == false) // old
                    {
                        MapCell cell = this.Map.GetCell(x, y);

                        if (cell.Tile != null)                         // ? ! 描画無し
                        {
                            DDDraw.DrawCenter(
                                cell.Tile.Picture,
                                mapTileX - camL + this.DrawMap_SlideX,
                                mapTileY - camT + this.DrawMap_SlideY
                                );
                        }
                    }
                }
            }
        }
Example #28
0
        protected override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                if (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), 150.0))
                {
                    Game.I.EL_AfterDrawMap.Add(() =>
                    {
                        DDDraw.DrawCenter(Ground.I.Picture.Stage01_Bg_Item03, this.X - DDGround.ICamera.X, this.Y - 48 - DDGround.ICamera.Y);
                        return(false);
                    });

                    // 当たり判定無し
                }
                yield return(true);
            }
        }
Example #29
0
        private void P_Draw()
        {
            if (this.Friend == null)
            {
                this.Friend = this.GetFriend();
            }
            else
            {
                if (this.Friend.HP == -1)
                {
                    Game.I.Enemies.Add(new Enemy_B0003_Egg(this.X, this.Y, this.Friend.X, this.Friend.Y));
                    this.Friend = null;
                }
            }

            if (!DDUtils.IsOutOfCamera(new D2Point(this.X, this.Y), 50.0))
            {
                double xBure = Math.Cos(this.Frame / 10.0) * 5.0;
                double yBure = Math.Sin(this.Frame / 10.0) * 5.0;

                DDDraw.DrawCenter(
                    Ground.I.Picture.Enemy_B0003,
                    this.X - DDGround.ICamera.X + xBure,
                    this.Y - DDGround.ICamera.Y + yBure
                    );

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

            // 最初の数フレーム間は無敵とする。
            // -- 再生後即死亡すると仲間に補足されず、次の再生が行われなくなってしまう。-- 1,2フレーム生き延びるだけで十分かもしれない。
            {
                if (this.Frame == 0)
                {
                    this.HP = 0;                     // 無敵
                }
                if (this.Frame == 5)
                {
                    this.HP = 1;                     // 無敵解除
                }
            }

            this.Frame++;
        }
Example #30
0
        public void Draw()
        {
            if (this.DeadScene.IsFlaming())
            {
                DDScene scene = this.DeadScene.GetScene();

                DDDraw.SetAlpha(0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Player, this.X, this.Y);
                DDDraw.DrawRotate(scene.Rate * 5.0);
                DDDraw.DrawZoom(1.0 + scene.Rate * 5.0);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                return;
            }
            if (this.BornScene.IsFlaming())
            {
                if (this.BornScene.IsJustFired())
                {
                    this.Born_X = -50.0;
                    this.Born_Y = DDConsts.Screen_H / 2.0;
                }
                DDScene scene = this.BornScene.GetScene();

                DDUtils.Approach(ref this.Born_X, this.X, 0.9 - 0.3 * scene.Rate);
                DDUtils.Approach(ref this.Born_Y, this.Y, 0.9 - 0.3 * scene.Rate);

                DDDraw.SetAlpha(0.5);
                DDDraw.DrawCenter(Ground.I.Picture.Player, this.Born_X, this.Born_Y);
                DDDraw.Reset();

                return;
            }
            if (this.MutekiScene.IsFlaming())
            {
                DDDraw.SetAlpha(0.5);
                DDDraw.DrawCenter(Ground.I.Picture.Player, this.X, this.Y);
                DDDraw.Reset();

                return;
            }
            DDDraw.DrawCenter(Ground.I.Picture.Player, this.X, this.Y);
        }