Exemplo n.º 1
0
        public Stage03()
        {
            music     = new Music("stage03.mp3");
            turn      = new TurnPage();
            countTime = new CountTime();

            river  = new AnimateActor("river", 14, new Point(560, 550), 2.3f);
            river2 = new AnimateActor("river", 14, new Point(560, 550), 2.3f);

            background = new ContinuousActor("GridWall", 4, new Point(100, 340), 1f, 880, 100, 0);
            grid       = new ContinuousActor("grid", 4, new Point(195, 700), 2, 500, 100, 0);
            winroad    = new AnimateActor("finish", 1, new Point(1820, 530), 1.8f); //520到底

            mainCharacter = new MainCharactor("dragon", 3, new Point(420, 430), 8); // size 6
            pinkDragon    = new PinkDragon("Pinkdragon", 3, new Point(1990, 550), 6);
            yellowDragon  = new YellowDragon[yellow_NUM];
            healthPts     = new HealthPt[yellow_NUM];

            for (int i = 0; i < yellow_NUM; i++)
            {
                yellowDragon[i] = new YellowDragon("yellowdragon", 2, new Point(555, 600), 4);
                healthPts[i]    = new HealthPt("ProgressBar10", 1, new Point(1200, 500 + 100 * i), 4);
            }

            // 說明頁物件
            explain        = new AnimateActor("story31", 1, new Point(550, 410), 2);
            rNextBtn       = new AnimateActor("Rnext", 1, new Point(1000, 430), 1.3f);
            ExplainPlayBtn = new AnimateActor("exPlay", 1, new Point(550, 630), 1); // 550 600
            lNextBtn       = new AnimateActor("graExpLBtn0", 1, new Point(100, 430), 1.3f);

            Global.target = yellowDragon[0].Enemys + yellowDragon[1].Enemys;
        }
Exemplo n.º 2
0
        //-------------- Stage02 建構子 ---------------//
        public Stage02()
        {
            music = new Music("stage2.mp3");

            turn       = new TurnPage();
            randomizer = new Random();
            countTime  = new CountTime();

            tinyDragons = new TinyDragon[TINYDRAGON_NUM];
            fires       = new AnimateActor[Fire_MaX_Num];

            healthPts              = new HealthPt[HEALTHPTS_NUM];
            brownDragonHealthPt    = new HealthPt("ProgressBar10", 1, new Point(500, 500), 3);
            brownDragonHealthPt.hp = BROWNDRAGON_Max_HP;
            brownDragon            = new BrownDragon("browndragon", 2, new Point(1550, 500), 2); //950
            brownDragonImgWidth    = brownDragon.brownDragon.img.Width;
            brownDragonImgHeight   = brownDragon.brownDragon.img.Height;

            clouds = new ContinuousActor("clouds", 7, new Point(100, 100), 1, 400, 100, 5);

            mainCharator = new MainCharactor("flydragon", 2, new Point(200, 400), 5f);

            for (int i = 0; i < TINYDRAGON_NUM; i++)
            {
                tinyDragons[i] = new TinyDragon("tinyDragon", 3, new Point(1000 + 50 * i * randomizer.Next(1, 5), 0 + 50 * i * randomizer.Next(1, 10)), 3);
                healthPts[i]   = new HealthPt("ProgressBar10", 1, new Point(500, 500), 6);
            }

            pinkBk       = new AnimateActor("pinkBk", 1, new Point(500, 390), 1.5f);
            cloudsCenter = new Point(100, 100);

            healthPtCount = 0; // 記數 : tinyDragon 的死亡數量
            //MessageBox.Show("" + tinyDragons[0].img.Width);

            //------說明頁


            if (Global.Mode > 0)
            {
                explain = new AnimateActor("Stage02explain0", 1, new Point(550, 410), 2);
            }
            else
            {
                explain = new AnimateActor("story21", 1, new Point(550, 410), 2);
            }
            ExplainPlayBtn = new AnimateActor("exPlay", 1, new Point(550, 630), 1);
            rNextBtn       = new AnimateActor("Rnext", 1, new Point(1000, 450), 1.3f);
            lNextBtn       = new AnimateActor("graExpLBtn0", 1, new Point(100, 450), 1.3f);

            Global.target = 1;
        }
Exemplo n.º 3
0
        public Stage01()
        {
            music = new Music("stage1.mp3");

            // 隨機背景
            clouds    = new ContinuousActor("clouds", 7, new Point(100, 100), 1, 400, 80, 5);
            mountains = new ContinuousActor("mountain", 6, new Point(100, 600), 1.2f, 350, 80, 0);
            grasses   = new ContinuousActor("Grass", 6, new Point(100, 658), 1.8f, 200, 80, 0);

            // 固定背景與物體
            background = new AnimateActor("bluesky", 1, new Point(800, 300), 1.3f);
            grass      = new AnimateActor("Grass11", 1, new Point(1000, 430), 1f);
            rainbow    = new AnimateActor("rainbow1", 1, new Point(1800, 300), 0.3f);

            // 動態互動物體
            stone = new AnimateActor("stone", 1, new Point(1100, 200), 3f);
            bone  = new AnimateActor("bone", 1, new Point(750, 450), 3);

            // 怪物們
            mainCharactor = new MainCharactor("dragon", 3, new Point(350, 500), 6);
            orangeDragon  = new OrangeDragon("orangedragon", 2, new Point(750, 500), 3);
            yellowBird    = new YellowBird("YellowBird", 3, new Point(1100, 100), 4);

            // 生命Bar
            healthyellow = new HealthPt("ProgressBar10", 1, new Point(1100, 0), 3);
            healthorange = new HealthPt("ProgressBar10", 1, new Point(1100, 500), 3);

            // 測試用按鈕
            playButton = new AnimateActor("Play1", 1, new Point(1000, 430), 15);
            newt       = new CountTime();

            // 說明頁物件
            if (Global.Mode > 0)
            {
                explain = new AnimateActor("explain2", 1, new Point(550, 410), 2);
            }
            else
            {
                explain = new AnimateActor("story11", 1, new Point(550, 410), 2);
            }
            ExplainPlayBtn = new AnimateActor("exPlay", 1, new Point(550, 630), 1); // 550 600
            oneHp01        = new AnimateActor("oneHp", 1, new Point(450, 390), 1);
            oneHp02        = new AnimateActor("oneHp", 1, new Point(750, 390), 1);
            rNextBtn       = new AnimateActor("Rnext", 1, new Point(1000, 430), 1.3f);
            lNextBtn       = new AnimateActor("graExpLBtn0", 1, new Point(100, 430), 1.3f);
            canPaintHp01   = false;
            canPaintHp02   = false;
            isAttackOrange = false;

            Global.target = orangeDragon.Enemys;
        }
Exemplo n.º 4
0
        //-------------- 放在 Form1.Animate 裡 ---------------//
        public void Action()
        {
            switch (step)
            {
            //遊戲進場
            case 0:
                Thread.Sleep(80);
                //step = 1;
                break;

            //遊戲開始
            case 1:
                countTime.StartT();
                Thread.Sleep(70);

                //------ maincharator 被射線打到
                if (brownDragon != null && brownDragon.brownDragon.Center.X <= 950 && brownDragon.myEndPoint.X <= 300)
                {
                    if (mainCharator.isClick(brownDragon.brownDragon.Center.X - 800
                                             , brownDragon.brownDragon.Center.Y))
                    {
                        if (countTime.MilSec(1000))
                        {
                            mainCharator.Motion(6);
                            brownDragon.Motion(0);
                            music.PlayMusic(5);
                            Global.HP--;
                        }
                    }
                }

                //----------------  clouds
                cloudsCenter = new Point(1300, 150 + 100 * randomizer.Next(1, 5));
                clouds.Action(-150, cloudsCenter, -1, 0);


                //------  mainCharator
                mainCharator.Action();

                //------ brownDragon
                if (brownDragon != null)
                {
                    brownDragon.Fly();
                }

                //--------- fire & progressBar
                for (int i = 0; i < Fire_MaX_Num; i++)
                {
                    if (fires[i] != null)
                    {
                        fires[i].Action();
                        //music.PlayMusic("fireAttack.mp3");
                        fires[i].Center = new Point(fires[i].Center.X + 30, fires[i].Center.Y);

                        if (fires[i].Center.X >= 1100)
                        {
                            fires[i] = null;
                        }
                    }
                    if (fires[i] != null)
                    {
                        for (int j = 0; j < TINYDRAGON_NUM; j++)
                        {
                            if (healthPts[j] != null && tinyDragons[j] != null)
                            {
                                if (tinyDragons[j].isClick(fires[i].Center.X + 10, fires[i].Center.Y)) // 如果小恐龍碰到火焰則...
                                {
                                    fires[i] = null;                                                   // 火焰消失
                                    music.PlayMusic(6);                                                // 小恐龍發出燃燒的聲音
                                    tinyDragons[j].Motion(1);                                          // 小恐龍圖變成燃燒的恐龍圖
                                    tinyDragons[j].hp--;                                               // tinyDragon 被火焰打到 hp 值減一
                                    healthPts[j].hp--;
                                    healthPts[j].Health(tinyDragons[j].hp, 10);                        // 血條依 tinyDragon 的 hp 值做變化
                                    if (healthPts[j].hp == 0)                                          // 如果血條為 0, 則...
                                    {
                                        healthPts[j]   = null;                                         // 血條為 null
                                        tinyDragons[j] = null;                                         // 小恐龍為 null
                                        healthPtCount++;
                                    }
                                    break;
                                }
                            }
                        }
                    }


                    //------ 火焰打到 brownDragon
                    if (fires[i] != null && brownDragon != null)         // 如果 brownDragon 被火焰打到, 則...
                    {
                        for (int k = 0; k < brownDragonImgHeight / 4; k++)
                        {
                            if (fires[i].isClick(brownDragon.brownDragon.Center.X - (brownDragonImgWidth / 4),
                                                 brownDragon.brownDragon.Center.Y - (brownDragonImgHeight / 16) + k) && brownDragon.hp != 0)
                            {
                                music.PlayMusic(6);
                                brownDragon.Motion(1);                                          // browmDragon 受傷圖
                                brownDragon.hp--;                                               // brownDragon 生命值減少
                                brownDragonHealthPt.hp--;                                       // 血條減少
                                brownDragonHealthPt.Health(brownDragon.hp, BROWNDRAGON_Max_HP); // 血條依 brownDragon 比例調整
                                fires[i] = null;                                                // 火焰消失
                                if (brownDragon.hp == 0)
                                {
                                    brownDragon         = null; // 如果 brownDragon 生命值為 0 則設為 null
                                    brownDragonHealthPt = null; // 血條設為 null
                                }
                                break;
                            }
                        }
                    }
                }

                //-------- 血條跟著 brownDragon
                if (brownDragonHealthPt != null && brownDragon != null)
                {
                    brownDragonHealthPt.Center = new Point(brownDragon.brownDragon.Center.X - 80, brownDragon.brownDragon.Center.Y - 100);
                }


                //--------- tinyDragon
                for (int i = 0; i < TINYDRAGON_NUM; i++)
                {
                    if (healthPts[i] != null && tinyDragons[i] != null)
                    {
                        healthPts[i].Center = new Point(tinyDragons[i].Center.X - 10, tinyDragons[i].Center.Y - 60);
                    }

                    if (tinyDragons[i] != null)
                    {
                        tinyDragons[i].Action();
                        if (mainCharator.isClick(tinyDragons[i].Center.X - 47, tinyDragons[i].Center.Y) && tinyDragons[i].hp != 0)     // 利用 size 過濾碰撞條件
                        {
                            if (countTime.Sec(1))
                            {
                                mainCharator.Motion(6);
                                Global.HP -= 1;
                                music.PlayMusic(1);
                            }     // 等待一秒再扣 HP
                        }
                    }
                }

                //--------- tinyDragon 追蹤 maincharator
                for (int i = 0; i < TINYDRAGON_NUM; i++)
                {
                    if (tinyDragons[i] != null)
                    {
                        double dist = Distance(tinyDragons[i].Center, mainCharator.Center);     // 計算 tinyDragon 與 maincharator 的距離
                        if (tinyDragons[i].Center.X <= mainCharator.Center.X + 170)
                        {
                            tinyDragons[i].Center = new Point(tinyDragons[i].Center.X - 20, tinyDragons[i].Center.Y);
                        }
                        else
                        {
                            int r = randomizer.Next(8, 20);
                            tinyDragons[i].Center = new Point((int)(tinyDragons[i].Center.X + (mainCharator.Center.X - tinyDragons[i].Center.X) * r / dist),
                                                              (int)(tinyDragons[i].Center.Y + (mainCharator.Center.Y - tinyDragons[i].Center.Y) * r / dist));
                        }

                        if (tinyDragons[i].Center.X <= -30)
                        {
                            tinyDragons[i].Center = new Point(1000 + 50 * i * randomizer.Next(8, 20), 0 + 50 * i * randomizer.Next(0, 5));
                        }
                    }
                }

                // 如果 hp 為 0 則回到 turntablePage
                if (Global.HP <= 0)
                {
                    step = 3;
                }

                //------ 判斷轉場 進下一關
                if (brownDragon == null /*&& healthPtCount == 5*/)
                {
                    Global.target = 0;
                    step          = 2;
                }
                countTime.EndT();
                break;

            //遊戲勝場
            case 2:
                turn.TurnWin(pageName.level02);
                break;

            //遊戲敗場
            case 3:
                turn.TurnGameOver(pageName.mainPage);
                break;
            }
        }