예제 #1
0
        public override void UpdateAnimation(GameTime _GameTime, CInput _Input)
        {
            if (Status == IDStatus.MOVE)
            {
                Sprite.Animation.FrameStart = 2;
                Sprite.Animation.FrameEnd = 3;
            }

            if (Status == IDStatus.FIRE)
            {
                Sprite.Animation.FrameStart = 1;
                Sprite.Animation.FrameEnd = 3;
            }

            if (Direction == IDDir.LEFT)
            {
                Sprite.Effect = SpriteEffects.None;
            }

            if (Direction == IDDir.RIGHT)
            {
                Sprite.Effect = SpriteEffects.FlipHorizontally;
            }

            //for (int i = 0; i < List_Of_Bullet.Count; i++)
            //{
            //    List_Of_Bullet[i].UpdateAnimation(_GameTime, _Input);
            //}

            base.UpdateAnimation(_GameTime, _Input);
        }
예제 #2
0
        public override void UpdateMovement(GameTime _GameTime, CInput _Input)
        {
            if (m_Status == IDStatus.ACTIVATE)
            {
                m_Velocity = new Vector2(0, -0.05f);
            }

            if (oldPosition.Y - m_Position.Y > Sprite.FrameHeight - 1 && m_Status == IDStatus.ACTIVATE)// && Status != IDStatus.UNACTIVATE)//dung animation chay len
            {
                m_Status = IDStatus.RUN;
                m_Velocity = Vector2.Zero;
                Direction = IDDir.RIGHT;
            }

            if (Status == IDStatus.RUN)
            {
                m_Accel.Y = 0.00098f;
                if (Direction == IDDir.LEFT)
                {
                    //m_Status = IDStatus.RUN;
                    m_Velocity = new Vector2(-0.1f, m_Velocity.Y);
                }

                if (Direction == IDDir.RIGHT)
                {
                    //m_Status = IDStatus.RUN;
                    m_Velocity = new Vector2(0.1f, m_Velocity.Y);
                }
            }

            base.Update(_GameTime, _Input);
        }
예제 #3
0
        public override void UpdateAnimation(GameTime _GameTime, CInput _Input)
        {
            if (m_Status == IDStatus.ALIVE)
            {
                m_Sprite.Animation.FrameStart = 0;
                Sprite.Animation.FrameEnd = 1;
            }
            if (m_Status == IDStatus.SPIN)
            {
                //Sprite.FrameHeight = 16;
                //Sprite.Animation.CurFrame = 4;
            }
            if (m_Status == IDStatus.HIDE)
            {
                //Sprite.FrameHeight = 16;
                //Sprite.Animation.SetLocalAnimation();
                //Sprite.Animation.CurFrame = 4;
            }

            #region.Chuyển hướng
            if (Status == IDStatus.ALIVE || Status == IDStatus.SPIN)
            {
                if (m_Direction == IDDir.LEFT)
                {
                    m_Sprite.Effect = SpriteEffects.None;
                }
                if (m_Direction == IDDir.RIGHT)
                {
                    m_Sprite.Effect = SpriteEffects.FlipHorizontally;
                }
            }
            #endregion

            base.UpdateAnimation(_GameTime, _Input);
        }
예제 #4
0
 public override void UpdateAnimation(GameTime _GameTime, CInput _Input)
 {
     m_Sprite.Animation.FrameStart = 0;
     m_Sprite.Animation.FrameEnd = 3;
     m_Sprite.Animation.TimeAnimation = 80.0f;
     base.UpdateAnimation(_GameTime, _Input);
 }
예제 #5
0
 public override void UpdateAnimation(GameTime _GameTime, CInput _Input)
 {
     //if (m_Status == IDStatus.UNACTIVATE)
     //{
     //    Sprite.Animation.CurFrame = 3;
     //}
     base.UpdateAnimation(_GameTime, _Input);
 }
예제 #6
0
 public void Update(GameTime _GameTime, CInput _Input)
 {
     m_GameTime    = (float)_GameTime.ElapsedGameTime.TotalMilliseconds;
     m_Position.X += m_Velocity.X * (float)_GameTime.ElapsedGameTime.TotalMilliseconds;
     m_Position.Y += m_Velocity.Y * (float)_GameTime.ElapsedGameTime.TotalMilliseconds;
     m_Velocity.X += m_Accel.X * (float)_GameTime.ElapsedGameTime.TotalMilliseconds;
     m_Velocity.Y += m_Accel.Y * (float)_GameTime.ElapsedGameTime.TotalMilliseconds;
 }
예제 #7
0
        public override void UpdateMovement(GameTime _GameTime, CInput _Input)
        {
            if (m_IDObject == IDObject.ITEM_SUPER_MUSHROOM)
            {
                if (m_Status == IDStatus.ACTIVATE)
                {
                    m_Velocity = new Vector2(0, -0.01f);
                }

                if (oldPosition.Y - m_Position.Y > Sprite.FrameHeight && m_Status == IDStatus.ACTIVATE)
                {
                    m_Status = IDStatus.RUN;
                    //m_Velocity = Vector2.Zero;
                    m_Dir = IDDir.RIGHT;
                }

                if (m_Status == IDStatus.RUN)
                {
                    m_Accel.Y = 0.00098f;
                    if (m_Dir == IDDir.LEFT)
                    {
                        //m_Status = IDStatus.RUN;
                        m_Velocity = new Vector2(-0.1f, m_Velocity.Y);
                    }

                    if (m_Dir == IDDir.RIGHT)
                    {
                        //m_Status = IDStatus.RUN;
                        m_Velocity = new Vector2(0.1f, m_Velocity.Y);
                    }
                }

                if (m_Velocity.Y > 1.0f)
                    m_Velocity.Y = 1.0f;

                if (m_Velocity.X > 0.1f)
                    m_Velocity.X = 0.1f;

                if (m_Velocity.X < -0.1)
                    m_Velocity.X = -0.1f;
            }

            if (IDObject == IDObject.ITEM_FIRE_FLOWER)
            {
                if (m_Status == IDStatus.ACTIVATE)
                {
                    m_Velocity = new Vector2(0, -0.01f);
                }

                if (oldPosition.Y - m_Position.Y > Sprite.FrameHeight - 1 && m_Status == IDStatus.ACTIVATE && Status != IDStatus.UNACTIVATE)//dung animation chay len
                {
                    m_Status = IDStatus.ALIVE;
                    m_Velocity = Vector2.Zero;
                }
            }

            base.Update(_GameTime, _Input);
        }
예제 #8
0
 public override void HandleInput(GameTime gameTime, CInput _Input)
 {
     if (_Input.KeyPressed(Keys.Back))
     {
         StateManager.getInst().ExitScreen();
         StateManager.getInst().AddScreen(new MenuState(IDGameState.MENU));
     }
     base.HandleInput(gameTime, _Input);
 }
예제 #9
0
 public override void UpdateMovement(GameTime _GameTime, CInput _Input)
 {
     if (Status == IDStatus.ACTIVATE)
     {
         m_Flag.Accel = new Vector2(0, 0.00098f);
         Status = IDStatus.UNACTIVATE;
     }
     m_Flag.Update(_GameTime, _Input);
     base.UpdateMovement(_GameTime, _Input);
 }
예제 #10
0
        public override void HandleInput(GameTime gameTime, CInput _Input)
        {
            CoolDown += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            if (CoolDown > 5000)
            {

                StateManager.getInst().ExitScreen();
                StateManager.getInst().AddScreen(new MenuState(IDGameState.MENU));
            }
            base.HandleInput(gameTime, _Input);
        }
예제 #11
0
        protected override void Initialize()
        {
            CResourceManager.GetInstance().Init(Content);
            SoundManager.LoadContent(Content);
            _fps = _eLapsedTime = 0;
            m_Input = new CInput();
            StateManager.getInst().Content = Content;
            StateManager.getInst().AddScreen(new IntroState(IDGameState.INTRO));
            StateManager.getInst().m_Game = this;

            base.Initialize();
        }
예제 #12
0
 public override void HandleInput(GameTime gameTime, CInput _Input)
 {
     CoolDown += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
     if (CoolDown > 2000)
     {
         CoolDown = 0;
         StateManager.getInst().ExitScreen();
         StateManager.getInst().AddScreen(new MenuState(IDGameState.MENU));
     }
     GlobalValue.IS_LOCK_KEYBOARD = false;
     base.HandleInput(gameTime, _Input);
 }
예제 #13
0
 public override void UpdateMovement(GameTime _GameTime, CInput _Input)
 {
     if (Math.Abs(Position.Y - oldPosition.Y) < 16)
     {
         Velocity = new Vector2(0, -0.1f);
     }
     else
     {
         Velocity = Vector2.Zero;
     }
     base.UpdateMovement(_GameTime, _Input);
     base.Update(_GameTime, _Input);
 }
예제 #14
0
        public override void UpdateAnimation(GameTime _GameTime, CInput _Input)
        {
            if (Direction == IDDir.LEFT)
            {
                Sprite.Effect = SpriteEffects.FlipHorizontally;
            }

            if (Direction == IDDir.RIGHT)
            {
                Sprite.Effect = SpriteEffects.None;
            }
            base.UpdateAnimation(_GameTime, _Input);
        }
예제 #15
0
        public override void UpdateMovement(GameTime _GameTime, CInput _Input)
        {
            if (Direction == IDDir.LEFT)
            {
                m_Velocity = new Vector2(-0.3f, m_Velocity.Y);
            }

            if (Direction == IDDir.RIGHT)
            {
                m_Velocity = new Vector2(0.3f, m_Velocity.Y);
            }
            base.UpdateMovement(_GameTime, _Input);
            base.Update(_GameTime, _Input);
        }
        public override void UpdateMovement(GameTime _GameTime, CInput _Input)
        {
            if (m_Status == IDStatus.ACTIVATE)
            {
                m_Velocity = new Vector2(0, -0.05f);
            }

            if (oldPosition.Y - m_Position.Y > Sprite.FrameHeight - 1 && m_Status == IDStatus.ACTIVATE && Status != IDStatus.UNACTIVATE)//dung animation chay len
            {
                m_Status = IDStatus.ALIVE;
                m_Velocity = Vector2.Zero;
            }
            base.Update(_GameTime, _Input);
        }
예제 #17
0
 public override void UpdateAnimation(GameTime _GameTime, CInput _Input)
 {
     if (m_Status == IDStatus.ALIVE)
     {
         //m_Sprite.UpdateAnimation(_GameTime);
         base.UpdateAnimation(_GameTime, _Input);
     }
     else
     {
         Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_IRON_BRICK));
         Sprite.Depth = 0.9f;
         //Sprite.Animation.SetLocalAnimation();
         //m_Sprite.Animation.CurFrame = 0;
     }
 }
예제 #18
0
 public override void HandleInput(GameTime gameTime, CInput _Input)
 {
     CoolDown += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
     if (CoolDown > 2000)
     {
         CoolDown = 0;
         StateManager.getInst().ExitScreen();
         StateManager.getInst().AddScreen(new MainGame(IDGameState.MAINGAME));
     }
     GlobalValue.IS_LOCK_KEYBOARD = false;
     if (_Input.KeyPressed(Keys.Delete))
     {
         GlobalValue.MARIO_LIFE++;
     }
     base.HandleInput(gameTime, _Input);
 }
        public override void UpdateMovement(GameTime _GameTime, CInput _Input)
        {
            if (m_Status == IDStatus.ACTIVATE)
            {
                m_Velocity = new Vector2(0, -0.05f);
            }

            if (oldPosition.Y - m_Position.Y > Sprite.FrameHeight && m_Status == IDStatus.ACTIVATE)
            {
                m_Status = IDStatus.RUN;
                //m_Velocity = Vector2.Zero;
                m_Dir = IDDir.RIGHT;
            }

            if (m_Status == IDStatus.RUN)
            {
                m_Accel.Y = 0.0098f;
                if (m_Dir == IDDir.LEFT)
                {
                    //m_Status = IDStatus.RUN;
                    m_Velocity = new Vector2(-0.2f, m_Velocity.Y);
                }

                if (m_Dir == IDDir.RIGHT)
                {
                    //m_Status = IDStatus.RUN;
                    m_Velocity = new Vector2(0.2f, m_Velocity.Y);
                }
            }

            if (m_Velocity.Y > 1.0f)
                m_Velocity.Y = 1.0f;

            if (m_Velocity.X > 0.2f)
                m_Velocity.X = 0.2f;

            if (m_Velocity.X < -0.2)
                m_Velocity.X = -0.2f;

            base.Update(_GameTime, _Input);
        }
예제 #20
0
        public override void UpdateMovement(GameTime _GameTime, CInput _Input)
        {
            if (m_Status == IDStatus.ACTIVATE && IDObject == IDObject.ITEM_COIN_ACTIVATED)
            {

                Sprite.Animation.FrameStart = 0;
                Sprite.Animation.TimeAnimation = 50.0f;
                if (m_Position.Y > oldPosition.Y - Sprite.FrameHeight - 1)
                {
                    Velocity = new Vector2(0, -.1f);
                }
                else
                {
                    Velocity = Vector2.Zero;
                }
                m_StopTime += (float)_GameTime.ElapsedGameTime.Milliseconds;
                if (m_StopTime >= 400.0f)
                    m_Status = IDStatus.DIE;
                base.Update(_GameTime, _Input);
            }
        }
예제 #21
0
        public override void UpdateAnimation(GameTime _GameTime, CInput _Input)
        {
            if (m_Status == IDStatus.ALIVE)
            {
                m_Sprite.Animation.FrameStart = 0;
                m_Sprite.Animation.FrameEnd = 1;
            }

            if (m_Status == IDStatus.BEFORE_DIE)
            {
                m_Sprite.Animation.CurFrame = 2;
            }

            if (Status == IDStatus.SHOOTED)
            {
                Sprite.Animation.CurFrame = 0;
                Sprite.Effect = SpriteEffects.FlipVertically;
            }

            base.UpdateAnimation(_GameTime, _Input);
        }
 public void Update(GameTime _GameTime, CInput _Input)
 {
     m_GameTime = (float)_GameTime.ElapsedGameTime.TotalMilliseconds;
     m_Position.X += m_Velocity.X * (float) _GameTime.ElapsedGameTime.TotalMilliseconds;
     m_Position.Y += m_Velocity.Y * (float) _GameTime.ElapsedGameTime.TotalMilliseconds;
     m_Velocity.X += m_Accel.X * (float) _GameTime.ElapsedGameTime.TotalMilliseconds;
     m_Velocity.Y += m_Accel.Y * (float)_GameTime.ElapsedGameTime.TotalMilliseconds;
 }
예제 #23
0
        /// <summary>
        /// Phân tích tín hiệu input để xử lý status cho Mario
        /// </summary>
        /// <param name="_Input"></param>
        /// <returns></returns>
        private void AnalysisInput(CInput _Input)
        {
            if (_Input.KeyDown(Keys.Right) && Status != IDStatus.MARIO_JUMP && !m_IsDisableRight)
            {
                Direction = IDDir.RIGHT;
                Accel = new Vector2(0.001f, Accel.Y);
                Status = IDStatus.MARIO_RUN;
            }

            if (_Input.KeyDown(Keys.Left) && Status != IDStatus.MARIO_JUMP && !m_IsDisableLeft)
            {
                Direction = IDDir.LEFT;
                Accel = new Vector2(-0.001f, Accel.Y);
                Status = IDStatus.MARIO_RUN;
            }

            if (_Input.KeyPressed(Keys.Up) && m_IsJumping == false && !m_IsDisableUp && Status != IDStatus.MARIO_ATTACK)
            {
                Status = IDStatus.MARIO_JUMP;
                m_IsJumping = true;
                Velocity = new Vector2(Velocity.X, -0.35f);
                if (IDObject == IDObject.SMALL_MARIO)
                {
                    SoundManager.PlaySound(ESound.SFX_JUMP_SMALL);
                }
                if (IDObject == IDObject.FIRE_MARIO|| IDObject == IDObject.SUPER_MARIO)
                {
                    SoundManager.PlaySound(ESound.SFX_JUMP_BIG);
                }
            }

            if (_Input.KeyDown(Keys.Down) && Status != IDStatus.MARIO_JUMP && !m_IsDisableDown)
            {
                //Velocity = Vector2.Zero;
                Accel = new Vector2(0, Accel.Y);
                //Status = IDStatus.MARIO_RUN;
                Status = IDStatus.MARIO_DOWN;
            }

            Damping(_Input);
        }
예제 #24
0
 /// <summary>
 /// Hãm vận tốc của Mario khi công còn nhận input
 /// </summary>
 /// <param name="_Input"></param>
 /// <returns></returns>
 private void Damping(CInput _Input)
 {
     if (!_Input.KeyDown(Keys.Left) && !_Input.KeyDown(Keys.Right))
     {
         Accel = new Vector2(0, Accel.Y);
         m_Velocity = new Vector2(m_Velocity.X - m_Velocity.X * 0.1f, m_Velocity.Y);
         if (Math.Abs(m_Velocity.X) <= 0.001f)
         {
             m_Velocity = new Vector2(0.0f, m_Velocity.Y);
             if(!_Input.KeyDown(Keys.Up) && !_Input.KeyPressed(Keys.Z) && !_Input.KeyDown(Keys.Down) && Status != IDStatus.TELEPORT)
             {
                 Status = IDStatus.MARIO_STAND;
             }
         }
     }
 }
예제 #25
0
        public override void UpdateMovement(GameTime _GameTime, CInput _Input)
        {
            Sprite.Depth = GlobalValue.ENEMY_SPRITE_DEPTH;
            // Gia tốc trọng trường
            if (m_Status == IDStatus.ALIVE)
            {
                m_Accel = new Vector2(0, 0.0098f);
                if (m_Direction == IDDir.LEFT)
                {
                    m_Velocity = new Vector2(-0.03f, m_Velocity.Y);
                }
                else if (m_Direction == IDDir.RIGHT)
                {
                    m_Velocity = new Vector2(0.03f, m_Velocity.Y);
                }
            }

            CheckShooted(_GameTime);

            if (CoolDown > 600)
            {
                Status = IDStatus.DIE;
            }

            if (m_Status == IDStatus.SPIN)
            {
                if (m_Direction == IDDir.LEFT)
                {
                    m_Velocity = new Vector2(-0.1f, m_Velocity.Y);
                }
                else if (m_Direction == IDDir.RIGHT)
                {
                    m_Velocity = new Vector2(0.1f, m_Velocity.Y);
                }
            }

            if (m_Status == IDStatus.HIDE)
            {
                m_Velocity = new Vector2(0, m_Velocity.Y);
            }
            //if (_Input.KeyDown(Microsoft.Xna.Framework.Input.Keys.Space))
            //{
            //    m_Status = IDStatus.DIE_CAN_ATTACK;
            //}
            if (m_Velocity.Y > 1.0f)
            {
                m_Velocity.Y = 1.0f;
            }

            if (m_Velocity.X > 1f)
            {
                m_Velocity.X = 1f;
            }

            if (m_Velocity.X < -1f)
            {
                m_Velocity.X = -1f;
            }
            base.Update(_GameTime, _Input);
        }
예제 #26
0
        public override void UpdateMovement(GameTime _GameTime, CInput _Input)
        {
            // Gia tốc trọng trường

            //if (Status == IDStatus.SHOOTED)
            //{
            //    m_Velocity.X = 0;

            //}
            CheckShooted(_GameTime);
            #region.Nếu mushroom còn sống
            if (m_Status == IDStatus.ALIVE)
            {
                m_Accel = new Vector2(m_Accel.X, 0.0098f);
                if (Direction == IDDir.LEFT)
                {
                    m_Status = IDStatus.ALIVE;
                    m_Velocity = new Vector2(-0.03f, m_Velocity.Y);
                }

                if (Direction == IDDir.RIGHT)
                {
                    m_Status = IDStatus.ALIVE;
                    m_Velocity = new Vector2(0.03f, m_Velocity.Y);
                }
            }
            #endregion

            if (m_Status == IDStatus.BEFORE_DIE)
            {
                m_Velocity = Vector2.Zero;
                CoolDown += (float)_GameTime.ElapsedGameTime.TotalMilliseconds;
            }

            if (CoolDown > 700)
            {
                m_Status = IDStatus.DIE;
            }

            if (m_Velocity.Y > 1f)
                m_Velocity.Y = 1f;

            if (m_Velocity.X > 0.09f)
                m_Velocity.X = 0.09f;

            if (m_Velocity.X < -0.09f)
                m_Velocity.X = -0.09f;

            base.Update(_GameTime, _Input);
        }
예제 #27
0
        public override void UpdateAnimation(GameTime _GameTime, CInput _Input)
        {
            if (Status != IDStatus.MARIO_STOP && Status != IDStatus.MARIO_AUTO_RUN)
            {
                Sprite.Depth = 1.0f;
            }
            //Mario nhỏ

            //Mario chạy
            if (m_Status == IDStatus.MARIO_RUN)
            {
                IsTeleport = false;
                m_Sprite.Animation.FrameStart = 0;
                m_Sprite.Animation.FrameEnd = 3;
                m_Sprite.Animation.TimeAnimation = 80.0f;
            }
            //Mario núp lùm
            if (m_Status == IDStatus.MARIO_DOWN)
            {
                //Nếu là mario nhỏ thì frame là 0, còn Mario to trở lên thì frame là 6
                if (IDObject == IDObject.SMALL_MARIO)
                {
                    Sprite.Animation.CurFrame = 0;
                }
                else
                {
                    Sprite.Animation.CurFrame = 6;
                }
                //Chỉnh lại sprite depth để có thể núp sau cây cột
                //Sprite.Depth = 0.1f;
            }

            if (Status == IDStatus.MARIO_JUMP)
            {
                Sprite.Animation.CurFrame = 5;
                IsTeleport = false;
            }

            //Mario đứng yên tại chỗ
            if (Status == IDStatus.MARIO_STAND)
            {
                Sprite.Animation.CurFrame = 0;
            }

            //Mario lên bàn thờ
            if (m_Status == IDStatus.DIE)
            {
                Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SMALL_MARIO));
                Sprite.Animation.CurFrame = 6;
            }

            //Mario bắn đạn
            if (m_Status == IDStatus.MARIO_ATTACK)
            {
                m_Sprite.Animation.CurFrame = 5;
            }

            if (Status == IDStatus.MARIO_STRIPPED)
            {
                if (Position.Y < 174)
                {
                    Sprite.Animation.CurFrame = 7;
                }
                else
                {
                    Sprite.Animation.CurFrame = 8;
                }
            }

            if (Status == IDStatus.MARIO_WIN)
            {
                Sprite.Animation.CurFrame = 8;
                m_CDWining += (float)_GameTime.ElapsedGameTime.TotalMilliseconds;

                if (m_CDWining > 500)
                {
                    SoundManager.PlaySound(ESound.SFX_STAGE_CLEAR);
                    Status = IDStatus.MARIO_AUTO_RUN;
                    m_CDWining = 0;
                }
            }
            if (Status == IDStatus.MARIO_AUTO_RUN)
            {
                Velocity = new Vector2(0.05f, Velocity.Y);
                Direction = IDDir.RIGHT;
                m_Sprite.Animation.FrameStart = 0;
                m_Sprite.Animation.FrameEnd = 3;
                m_Sprite.Animation.TimeAnimation = 80.0f;
                GlobalValue.IS_LOCK_KEYBOARD = true;
            }

            if (Status == IDStatus.MARIO_STOP)
            {
                GlobalValue.IS_LOCK_KEYBOARD = true;
            }

            if (Status == IDStatus.MARIO_DOWN)
            {
                if (IDObject == IDObject.SMALL_MARIO)
                {
                    Sprite.Animation.CurFrame = 0;
                }
                else
                {
                    Sprite.Animation.CurFrame = 6;
                }
            }

            if (Status == IDStatus.TELEPORT)
            {
                GlobalValue.IS_LOCK_KEYBOARD = true;
                Sprite.Depth = 0.05f;

            }

            //Mario bất tử
            if (m_Status == IDStatus.MARIO_UPCAST)
            {
                IsUpCast = true;
            }

            if (Status == IDStatus.MARIO_INVINCIBLE)
            {
                IsInvincible = true;
            }

            if (Status == IDStatus.MARIO_DOWNCAST)
            {
                IsDownCast = true;
            }

            if (GlobalValue.IS_GO_DOWN)
            {
                Direction = IDDir.RIGHT;
                Sprite.Depth = 0.05f;
                if (IDObject == IDObject.SMALL_MARIO)
                {
                    Sprite.Animation.CurFrame = 0;
                }
                else
                {
                    Sprite.Animation.CurFrame = 6;
                }
            }

            if (GlobalValue.IS_GO_UP)
            {
                Sprite.Depth = 0.05f;
                Direction = IDDir.RIGHT;
                Sprite.Animation.CurFrame = 0;
            }

            ManageFreezeTime(_GameTime);
            DownCast(_GameTime);
            UpCast(_GameTime);
            Invincible(_GameTime);

            #region.Xác định hướng di chuyển
            if (Direction == IDDir.RIGHT)
                m_Sprite.Effect = SpriteEffects.None;
            if(Direction == IDDir.LEFT)
                m_Sprite.Effect = SpriteEffects.FlipHorizontally;
            #endregion

            base.UpdateAnimation(_GameTime, _Input);
        }
예제 #28
0
 private void UpdateBullet(GameTime _GameTime, CInput _Input)
 {
     if (m_Bullet1 != null)
     {
         m_Bullet1.UpdateAnimation(_GameTime, _Input);
         m_Bullet1.UpdateMovement(_GameTime, _Input);
     }
     if (m_Bullet2 != null)
     {
         m_Bullet2.UpdateAnimation(_GameTime, _Input);
         m_Bullet2.UpdateMovement(_GameTime, _Input);
     }
 }
예제 #29
0
 public override void UpdateMovement(GameTime _GameTime, CInput _Input)
 {
     if (m_Status == IDStatus.DEACTIVATE)
     {
         //if (m_GreenMushroom.Status == IDStatus.UNACTIVATE)
         {
             switch (Item.IDObject)
             {
                 case IDObject.ITEM_COIN_ACTIVATED:
                     SoundManager.PlaySound(ESound.SFX_COIN);
                     GlobalValue.MARIO_SCORE += 100;
                     GlobalValue.MARIO_COIN += 1;
                     break;
                 case IDObject.ITEM_GROW_UP:
                     SoundManager.PlaySound(ESound.SFX_ITEM_APPEAR);
                     if (IDObject.SMALL_MARIO == IDObject.SMALL_MARIO)
                     {
                         Item.IDObject = IDObject.ITEM_SUPER_MUSHROOM;
                         Item.Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ITEM_SUPER_MUSHROOM));
                     }
                     if (GlobalValue.ID_MARIO == IDObject.SUPER_MARIO || GlobalValue.ID_MARIO == IDObject.FIRE_MARIO)
                     {
                         Item.IDObject = IDObject.ITEM_FIRE_FLOWER;
                         Item.Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ITEM_FIRE_FLOWER));
                     }
                     break;
                 case IDObject.ITEM_1UP_MUSHROOM:
                     SoundManager.PlaySound(ESound.SFX_ITEM_APPEAR);
                     break;
                 case IDObject.ITEM_STARMAN:
                     SoundManager.PlaySound(ESound.SFX_ITEM_APPEAR);
                     break;
                 default:
                     break;
             }
             m_Item.Status = IDStatus.ACTIVATE;
         }
         m_Status = IDStatus.UNACTIVATE;
     }
     if (m_Item != null)
     {
         //m_RedMushroom.Update(_GameTime, _Input);
         //m_GreenMushroom.UpdateMovement(_GameTime, _Input);
         if (m_Item.Status == IDStatus.DIE)
         {
             //m_GreenMushroom = null;
         }
     }
     //base.UpdateMovement(_GameTime, _Input);
 }
예제 #30
0
        public override void UpdateMovement(GameTime _GameTime, CInput _Input)
        {
            //CoolDownFire += (float)_GameTime.ElapsedGameTime.TotalMilliseconds;

            Accel = new Vector2(Accel.X, 0.00098f);

            if (m_Status == IDStatus.MOVE)
            {
                if (Direction == IDDir.LEFT)
                {
                    m_Velocity = new Vector2(-0.03f, m_Velocity.Y);
                }

                if (Direction == IDDir.RIGHT)
                {
                    m_Velocity = new Vector2(0.03f, m_Velocity.Y);
                }
            }

            if (Status == IDStatus.FIRE)
            {

                Velocity = Vector2.Zero;
                //Direction = tempDirection;
                if (CoolDown(ref CoolDownBullet, 800, _GameTime))
                {
                    //BossBullet b = new BossBullet(new Vector2(this.Position.X, GlobalValue.MARIO_POSITION.Y), this.Direction);
                    //List_Of_Bullet.Add(b);
                    BossBullet b = new BossBullet(new Vector2(this.Position.X, this.Position.Y), this.Direction);
                    GlobalValue.List_Of_Bullet.Add(b);
                }
                if (CoolDown(ref CoolDownFire, 1000, _GameTime))
                {
                    Status = IDStatus.MOVE;
                }
            }

            if (Boss_Heath_Point <= 0)
            {
                Status = IDStatus.DIE;
            }

            if (CoolDown(ref CoolDownMove, 3000, _GameTime) && CanFire)
            {
                Status = IDStatus.FIRE;
            }

            //for (int i = 0; i < List_Of_Bullet.Count; i++)
            //{
            //    List_Of_Bullet[i].UpdateMovement(_GameTime, _Input);
            //}

            base.UpdateMovement(_GameTime, _Input);
            base.Update(_GameTime, _Input);
        }
예제 #31
0
        public override void UpdateMovement(GameTime _GameTime, CInput _Input)
        {
            GlobalValue.MARIO_POSITION = this.Position;
            if (_Input.KeyPressed(Keys.Z) && IDObject == IDObject.FIRE_MARIO)
            {
                AddBullet();
                if (Sprite.Animation.CurFrame != 5)
                {
                    Sprite.Animation.CurFrame = 5;
                    Sprite.Animation.SetLocalAnimation();
                }
                Status = IDStatus.MARIO_ATTACK;
            }
            // Gia tốc trọng trường
            if (Status != IDStatus.TELEPORT)
            {
                Accel = new Vector2(m_Accel.X, 0.00098f);
            }

            if (Status != IDStatus.MARIO_JUMP && Status != IDStatus.DIE && !GlobalValue.IS_LOCK_KEYBOARD)
            {
                AnalysisInput(_Input);
            }
            //ManageTeleport(_GameTime);
            UpdateBullet(_GameTime, _Input);
            ManageBullet();
            LimitSpeed();
            CheckDead();

            base.Update(_GameTime, _Input);
        }
예제 #32
0
 virtual public void UpdateMovement(GameTime _GameTime, CInput _Input)
 {
     //_Input.Update();
 }
예제 #33
0
 virtual public void UpdateAnimation(GameTime _GameTime, CInput _Input)
 {
     _Input.Update();
     m_Sprite.UpdateAnimation(_GameTime);
 }