예제 #1
0
파일: Lv.cs 프로젝트: TaryHuang/Bobo
        public void Draw()
        {
            for (int i = 0; i < Lvalue.boxMax; i++)
            {
                Lvalue.box[i].Draw();
            }
            pass.Draw();
            ball.Draw();



            Game1.P.Draw(Game1.picBar, new Vector2(0, 400), Color.White);
            MYtimer.Draw();


            //***************
            if (MYLV <= 9)
            {
                Game1.P.Draw(MYtimer.changeImg(MYLV.ToString()), new Vector2(80 + 10, 430), Color.White);
            }
            else
            {
                str = MYLV.ToString();
                Game1.P.Draw(MYtimer.changeImg(str[0].ToString()), new Vector2(80, 430), Color.White);
                Game1.P.Draw(MYtimer.changeImg(str[1].ToString()), new Vector2(80 + 20, 430), Color.White);
            }
            //***************


            //破關就顯示破關畫面
            if (pass.passT)
            {
                passed.Draw();
                Fasttimer.Draw(); //最高紀錄
                nowtimer.Draw();  //目前紀錄
            }
        }
예제 #2
0
파일: Lv.cs 프로젝트: TaryHuang/Bobo
        public void UPDATE()
        {
            MYtimer.UPDATE();
            //判斷是否超過地圖位置
            if (ball.banGround())
            {
                ball.setPos(Lvalue.ballPos);
                return;
            }



            if (!pass.passT)
            {
                Lvalue.UPDATE();//若不明物,可以移動的畫 就直接update物體移動



                if (pass.H.Intersects(ball.H))
                {
                    pass.setP(Game1.Lv, MYtimer.getTime());//破關將破關資料  回寫資料庫 並且紀錄破關秒數
                    pass.passT = true;
                    MYtimer.stop();


                    //將 最快時間及目前時間 顯示出來
                    Fasttimer.setN(Fasttimer.fast(MYLV));
                    nowtimer.setN(MYtimer.getTime());
                    return;
                }

                if (Lvalue.match(ball.H))
                {
                    ball.setPos(Lvalue.ballPos);
                }



                for (int i = 0; i < Game1.touchState.Count; i++)
                {
                    touchLocation = Game1.touchState[i];


                    if (Game1.touchState[i].State == TouchLocationState.Pressed)
                    {
                        if (SORT == 1)
                        {
                            F = F_DOWN; //緩速啟動
                        }

                        stop = true;
                    }
                    if (Game1.touchState[i].State == TouchLocationState.Released)
                    {
                        if (SORT == 1)
                        {
                            F = F_UP;//緩速關閉
                        }
                        stop = false;
                    }
                }//for
            }
            else
            {
                for (int i = 0; i < Game1.touchState.Count; i++)
                {
                    touchLocation = Game1.touchState[i];


                    if (Game1.touchState[i].State == TouchLocationState.Pressed)
                    {
                        if (passed.L1.touchXY(touchLocation.Position.X, touchLocation.Position.Y))
                        {
                            //重新挑戰
                            Game1.Game = new Lv(Game1.Lv);
                        }
                        if (!passed.L2.Stop && passed.L2.touchXY(touchLocation.Position.X, touchLocation.Position.Y))
                        {
                            //下一關
                            Game1.Lv  += 1;
                            Game1.Game = new Lv(Game1.Lv);
                        }
                    }
                }//for
            }
        }