public SmallClound(Vector2 _Position)
     : base(_Position)
 {
     IDObject = IDObject.MISC_SMALL_CLOUND;
     Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_SMALL_CLOUND));
     Sprite.Depth = GlobalValue.MISC_SPRITE_DEPTH;
 }
 public QuestionBrick(Vector2 _Position, IDObject _IDItem)
     : base(_Position)
 {
     m_IDObject = IDObject.MISC_QUESTION_BRICK;
     m_Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_QUESTION_BRICK));
     m_Status = IDStatus.ALIVE;
     Sprite.Depth = GlobalValue.MISC_SPRITE_DEPTH;
     switch (_IDItem)
     {
         //case IDObject.ITEM_COIN_ACTIVATED:
         //    m_Item = new ItemCoin(_Position, _IDItem);
         //    break;
         //case IDObject.ITEM_GROW_UP:
         //    m_Item = new ItemGrowUp(_Position);
         //    //m_Item = new CAnimationObject(_Position);
         //    break;
         //case IDObject.ITEM_1UP_MUSHROOM:
         //    m_Item = new Item1UpMushroom(_Position);
         //    //m_Item = new GreenMushroom(_Position);
         //    break;
         //case IDObject.ITEM_STARMAN:
         //    m_Item = new ItemStarman(_Position);
         //    break;
         default:
             break;
     }
 }
 public Flag(Vector2 _Position)
     : base(_Position)
 {
     IDObject = IDObject.MISC_FLAG;
     Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_FLAG));
     Sprite.Depth = GlobalValue.MISC_SPRITE_DEPTH;
 }
 public HardBrick(Vector2 _Position)
     : base(_Position)
 {
     IDObject = IDObject.MISC_HARD_BRICK;
     Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_HARD_BRICK));
     Sprite.Depth = GlobalValue.MISC_SPRITE_DEPTH;
 }
 public StockPipe(Vector2 _Position)
     : base(_Position)
 {
     IDObject = IDObject.MISC_STOCK_PIPE;
     Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_STOCK_PIPE));
     Sprite.Depth = GlobalValue.MISC_SPRITE_DEPTH;
 }
 public SmallGrass(Vector2 _Position)
     : base(_Position)
 {
     IDObject = IDObject.MISC_SMALL_GRASS;
     Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_SMALL_GRASS));
     Sprite.Depth = GlobalValue.GRASS_SPRITE_DEPTH;
 }
 public BigMountain(Vector2 _Position)
     : base(_Position)
 {
     IDObject = IDObject.MISC_BIG_MOUNTAIN;
     Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_BIG_MOUNTAIN));
     Sprite.Depth = GlobalValue.GRASS_SPRITE_DEPTH;
 }
 public override void InitState(ContentManager CM)
 {
     MediaPlayer.Stop();
     Icon = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ICON_COIN));
     Icon.Position = new Vector2(145, 10);
     base.InitState(CM);
 }
 public Bullet(Vector2 _Position, IDDir _Dir)
     : base(_Position)
 {
     m_IDObject = IDObject.BULLET;
     m_Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.BULLET));
     Direction = _Dir;
     Sprite.Depth = GlobalValue.MARIO_SPRITE_DEPTH;
 }
 public ItemGrowUp(Vector2 _Position)
     : base(_Position)
 {
     m_IDObject = IDObject.ITEM_GROW_UP;
     m_Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ITEM_SUPER_MUSHROOM));
     m_Status = IDStatus.UNACTIVATE;
     oldPosition = _Position;
 }
 public BossBullet(Vector2 _Position, IDDir _Direction)
     : base(_Position)
 {
     Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ENEMY_BOSS_BULLET));
     Sprite.Depth = GlobalValue.ENEMY_SPRITE_DEPTH;
     Direction = _Direction;
     IDObject = IDObject.ENEMY_BOSS_BULLET;
 }
 public ItemSuperMushroom(Vector2 _Position)
     : base(_Position)
 {
     m_IDObject = IDObject.ITEM_SUPER_MUSHROOM;
     m_Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ITEM_SUPER_MUSHROOM));
     m_Status = IDStatus.UNACTIVATE;
     m_Sprite.Depth = 0.1f;
     oldPosition = _Position;
 }
 public GatePipe(Vector2 _Position)
     : base(_Position)
 {
     IDObject = IDObject.MISC_GATE_PIPE;
     Status = IDStatus.GATE_PIPE_DOWN;
     Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_GATE_PIPE));
     Sprite.Depth = GlobalValue.MISC_SPRITE_DEPTH;
     Portal = _Position;
 }
 public GoalPole(Vector2 _Position)
     : base(_Position)
 {
     IDObject = IDObject.MISC_GOAL_POLE;
     Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_GOAL_POLE));
     Sprite.Depth = GlobalValue.MISC_SPRITE_DEPTH;
     m_Flag = new Flag(new Vector2(Position.X - 13, Position.Y + 8));
     Status = IDStatus.UNACTIVATE;
 }
 public Goomba(Vector2 _Position,IDDir _Dir)
     : base(_Position)
 {
     m_IDObject = IDObject.ENEMY_GOOMBA_OW;
     m_Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ENEMY_GOOMBA_OW));
     Direction = _Dir;
     m_Status = IDStatus.ALIVE;
     Sprite.Depth = GlobalValue.ENEMY_SPRITE_DEPTH;
 }
 public BaseBrick(Vector2 _Position)
     : base(_Position)
 {
     //gọi copy constructor của sprite
     Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_BASE_BRICK));
     //gán ID của object
     IDObject = IDObject.MISC_BASE_BRICK;
     //gán độ sâu của sprite
     Sprite.Depth = GlobalValue.MISC_SPRITE_DEPTH;
 }
 public Koopa(Vector2 _Position)
     : base(_Position)
 {
     m_IDObject = IDObject.ENEMY_KOOPA_OW;
     m_Position = _Position;
     m_Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ENEMY_KOOPA_OW));
     m_Status = IDStatus.ALIVE;
     m_Direction = IDDir.RIGHT;
     Sprite.Depth = GlobalValue.ENEMY_SPRITE_DEPTH;
 }
Exemple #18
0
 public CObject(Vector2 _Position)
 {
     m_Position      = _Position;
     m_StartPosition = m_Position;
     m_Sprite        = null;
     //m_Status = IDStatus.ALIVE;
     m_IsAlive     = true;
     m_IsVisible   = false;
     m_IsColliable = false;
 }
 public CastleFlag(Vector2 _Position, IDObject _IDObject)
     : base(_Position)
 {
     oldPosition = _Position;
     IDObject = IDObject.MISC_STAR_FLAG_CASTLE;
     if (_IDObject == IDObject.MISC_STAR_FLAG_CASTLE)
     {
         Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.MISC_STAR_FLAG_CASTLE));
     }
     Sprite.Depth = 0.05f;
 }
Exemple #20
0
        //IDDir tempDirection = IDDir.LEFT;
        public Boss(Vector2 _Position)
            : base(_Position)
        {
            IDObject = IDObject.ENEMY_BOSS;
            Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ENEMY_BOSS));
            Sprite.Depth = GlobalValue.ENEMY_SPRITE_DEPTH;
            //List_Of_Bullet = new List<BossBullet>();

            Direction = IDDir.LEFT;
            Status = IDStatus.MOVE;
        }
Exemple #21
0
 public CObject(Vector2 _Position)
 {
     m_Position      = _Position;
     m_StartPosition = m_Position;
     m_Sprite        = null;
     //m_Status = IDStatus.ALIVE;
     m_IsAlive     = true;
     m_IsVisible   = false;
     m_IsColliable = false;
     m_Index       = ++GlobalValue.OBJECT_INDEX;
 }
Exemple #22
0
 public CObject(Vector2 _Position)
 {
     m_Position      = _Position;
     m_StartPosition = m_Position;
     m_Sprite        = null;
     //m_Status = IDStatus.ALIVE;
     m_IsAlive      = true;
     m_IsVisible    = false;
     m_IsColliable  = false;
     m_Index        = ++GlobalValue.OBJECT_INDEX;
     m_rangMovement = new Rectangle((int)m_Position.X - 200, (int)m_Position.Y - 200, 200, 200);
 }
 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;
     }
 }
 public CSprite(CSprite _Copy)
 {
     m_IDResource = _Copy.m_IDResource;
     m_SoureRectangle = _Copy.m_SoureRectangle;
     m_FrameWidth = _Copy.m_FrameWidth;
     m_FrameHeight = _Copy.m_FrameHeight;
     m_Cols = _Copy.m_Cols;
     m_Texture = _Copy.m_Texture;
     m_Animation = new CAnimation(_Copy.m_Animation);
     m_Origin = _Copy.m_Origin;
     m_Position = _Copy.m_Position;
     m_Color = _Copy.m_Color;
     m_Rotation = _Copy.m_Rotation;
     m_Scale = _Copy.m_Scale;
     m_Effect = _Copy.m_Effect;
     m_Depth = _Copy.m_Depth;
 }
Exemple #25
0
 public CSprite(CSprite _Copy)
 {
     m_IDResource     = _Copy.m_IDResource;
     m_SoureRectangle = _Copy.m_SoureRectangle;
     m_FrameWidth     = _Copy.m_FrameWidth;
     m_FrameHeight    = _Copy.m_FrameHeight;
     m_Cols           = _Copy.m_Cols;
     m_Texture        = _Copy.m_Texture;
     m_Animation      = new CAnimation(_Copy.m_Animation);
     m_Origin         = _Copy.m_Origin;
     m_Position       = _Copy.m_Position;
     m_Color          = _Copy.m_Color;
     m_Rotation       = _Copy.m_Rotation;
     m_Scale          = _Copy.m_Scale;
     m_Effect         = _Copy.m_Effect;
     m_Depth          = _Copy.m_Depth;
 }
 public ItemCoin(Vector2 _Position, IDObject _IDObject)
     : base(_Position)
 {
     IDObject = _IDObject;
     switch (_IDObject)
     {
         case IDObject.ITEM_COIN_ACTIVATED:
             m_Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ITEM_COIN_ACTIVATED));
             Sprite.Depth = 0.1f;
             break;
         case IDObject.ITEM_COIN_NORMAL:
             Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ITEM_COIN_NORMAL));
             break;
         default:
             break;
     }
     oldPosition = _Position;
 }
        public Mario(Vector2 _Position)
            : base(_Position)
        {
            Direction = IDDir.RIGHT;
            m_Status = IDStatus.MARIO_STAND;
            m_Velocity = Vector2.Zero;
            m_Accel = Vector2.Zero;
            m_IDObject = GlobalValue.MARIO_IDOBJECT;
            m_IsJumping = false;
            m_IsDuck = false;
            m_Random = new Random();
            if (IDObject == IDObject.SMALL_MARIO)
            {
                m_Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SMALL_MARIO));
            }
            if (IDObject == IDObject.SUPER_MARIO)
            {
                m_Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SUPER_MARIO));
            }
            if (IDObject == IDObject.FIRE_MARIO)
            {
                m_Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.FIRE_MARIO));
            }
            SmallSprite = new List<CSprite>();
            BigSprite = new List<CSprite>();
            SmallSprite.Add(new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SMALL_MARIO_INVICIBILITY)));
            SmallSprite.Add(new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SMALL_MARIO_INVICIBILITY2)));
            SmallSprite.Add(new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SMALL_MARIO_INVICIBILITY3)));
            BigSprite.Add(new CSprite(CResourceManager.GetInstance().GetResource(IDResource.BIG_MARIO_INVICIBILITY)));
            BigSprite.Add(new CSprite(CResourceManager.GetInstance().GetResource(IDResource.BIG_MARIO_INVICIBILITY2)));
            BigSprite.Add(new CSprite(CResourceManager.GetInstance().GetResource(IDResource.BIG_MARIO_INVICIBILITY3)));

            Sprite.Depth = GlobalValue.MARIO_SPRITE_DEPTH;
            m_CoolDownChanging = 0;
            m_CDColor = 0;
            m_CoolDownInvincible = 0;
            m_isWorldFreeze = false;
            m_isDeath = false;
            rand = new Random();
        }
 public CObject(Vector2 _Position)
 {
     m_Position = _Position;
     m_StartPosition = m_Position;
     m_Sprite = null;
     //m_Status = IDStatus.ALIVE;
     m_IsAlive = true;
     m_IsVisible = false;
     m_IsColliable = false;
     m_Index = ++GlobalValue.OBJECT_INDEX;
     m_rangMovement = new Rectangle((int)m_Position.X - 200,(int) m_Position.Y - 200, 200, 200);
 }
        private CResourceManager()
        {
            #region CSprite
            Sprite_Small_Mario      = new CSprite(IDResource.SMALL_MARIO, 9, 16, 16, 9);
            Sprite_Super_Mario      = new CSprite(IDResource.SUPER_MARIO, 9, 16, 32, 9);
            Sprite_Fire_Mario       = new CSprite(IDResource.FIRE_MARIO, 9, 16, 32, 9);
            Sprite_Big_Invi         = new CSprite(IDResource.BIG_MARIO_INVICIBILITY, 9, 16, 32, 9);
            Sprite_Big_Invi2        = new CSprite(IDResource.BIG_MARIO_INVICIBILITY2, 9, 16, 32, 9);
            Sprite_Big_Invi3        = new CSprite(IDResource.BIG_MARIO_INVICIBILITY3, 9, 16, 32, 9);
            Sprite_Small_Invi       = new CSprite(IDResource.SMALL_MARIO_INVICIBILITY, 9, 16, 16, 9);
            Sprite_Small_Invi2      = new CSprite(IDResource.SMALL_MARIO_INVICIBILITY2, 9, 16, 16, 9);
            Sprite_Small_Invi3      = new CSprite(IDResource.SMALL_MARIO_INVICIBILITY3, 9, 16, 16, 9);
            Sprite_Base_Brick       = new CSprite(IDResource.MISC_BASE_BRICK, 1, 16, 16, 7);
            Sprite_Question_Brick   = new CSprite(IDResource.MISC_QUESTION_BRICK, 4, 16, 16, 4);
            Sprite_Iron_Brick       = new CSprite(IDResource.MISC_IRON_BRICK, 1, 16, 16, 1);
            Sprite_Activated_Coin   = new CSprite(IDResource.ITEM_COIN_ACTIVATED, 4, 16, 16, 4);
            Sprite_Normal_Coin      = new CSprite(IDResource.ITEM_COIN_NORMAL, 4, 16, 16, 4);
            Sprite_Fire_Flower      = new CSprite(IDResource.ITEM_FIRE_FLOWER, 4, 16, 16, 4);
            Sprite_Super_Mushroom   = new CSprite(IDResource.ITEM_SUPER_MUSHROOM, 4, 16, 16, 4);
            Sprite_1_Up_Mushroom    = new CSprite(IDResource.ITEM_1UP_MUSHROOM, 4, 16, 16, 4);
            Sprite_Starman          = new CSprite(IDResource.ITEM_STARMAN, 4, 16, 16, 4);
            Sprite_GoomBa_OW        = new CSprite(IDResource.ENEMY_GOOMBA_OW, 3, 16, 16, 3);
            Sprite_Koopa_OW         = new CSprite(IDResource.ENEMY_KOOPA_OW, 6, 16, 24, 6);
            Sprite_Piece_1          = new CSprite(IDResource.MISC_PIECE_1, 1, 16, 16, 1);
            Sprite_Piece_2          = new CSprite(IDResource.MISC_PIECE_2, 1, 16, 16, 1);
            Sprite_Soft_Brick       = new CSprite(IDResource.MISC_SOFT_BRICK, 1, 16, 16, 1);
            Sprite_Stock_Pipe       = new CSprite(IDResource.MISC_STOCK_PIPE, 1, 32, 16, 1);
            Sprite_Gate_Pipe        = new CSprite(IDResource.MISC_GATE_PIPE, 1, 32, 16, 1);
            Sprite_Up_Pipe          = new CSprite(IDResource.MISC_UP_PIPE, 1, 62, 32, 1);
            Sprite_Big_Grass        = new CSprite(IDResource.MISC_BIG_GRASS, 1, 64, 16, 1);
            Sprite_Medium_Grass     = new CSprite(IDResource.MISC_MEDIUM_GRASS, 1, 48, 16, 1);
            Sprite_Small_Grass      = new CSprite(IDResource.MISC_SMALL_GRASS, 1, 32, 16, 1);
            Sprite_Medium_Mountain  = new CSprite(IDResource.MISC_MEDIUM_MOUNTAIN, 1, 48, 24, 1);
            Sprite_Big_Mountain     = new CSprite(IDResource.MISC_BIG_MOUNTAIN, 1, 80, 35, 1);
            Sprite_Hard_Brick       = new CSprite(IDResource.MISC_HARD_BRICK, 1, 16, 16, 1);
            Sprite_Hide_Koopa_OW    = new CSprite(IDResource.ENEMY_HIDE_KOOPA_OW, 2, 16, 16, 2);
            Sprite_Bullet           = new CSprite(IDResource.BULLET, 4, 8, 8, 2);
            Sprite_Goal_Pole        = new CSprite(IDResource.MISC_GOAL_POLE, 1, 8, 136, 1);
            Sprite_Flag             = new CSprite(IDResource.MISC_FLAG, 1, 16, 16, 1);
            Sprite_Castle           = new CSprite(IDResource.MISC_CASTLE, 1, 80, 80, 1);
            Sprite_Star_Flag_Castle = new CSprite(IDResource.MISC_STAR_FLAG_CASTLE, 1, 16, 32, 1);
            Sprite_Firework         = new CSprite(IDResource.MISC_FIREWORK, 3, 16, 16, 1);
            Sprite_Small_Clound     = new CSprite(IDResource.MISC_SMALL_CLOUND, 1, 32, 24, 1);
            Sprite_Medium_Clound    = new CSprite(IDResource.MISC_MEDIUM_CLOUND, 1, 48, 24, 1);
            Sprite_Big_Clound       = new CSprite(IDResource.MISC_BIG_CLOUND, 1, 64, 24, 1);

            BG_GameOver = new CSprite(IDResource.GAME_OVER, 1, 368, 224, 1);
            BG_LoadGame = new CSprite(IDResource.LOAD, 1, 368, 224, 1);
            #endregion

            #region Letter
            Letter_A           = new CSprite(IDResource.LETTER_A, 1, 8, 8, 1);
            Letter_B           = new CSprite(IDResource.LETTER_B, 1, 8, 8, 1);
            Letter_C           = new CSprite(IDResource.LETTER_C, 1, 8, 8, 1);
            Letter_D           = new CSprite(IDResource.LETTER_D, 1, 8, 8, 1);
            Letter_E           = new CSprite(IDResource.LETTER_E, 1, 8, 8, 1);
            Letter_F           = new CSprite(IDResource.LETTER_F, 1, 8, 8, 1);
            Letter_G           = new CSprite(IDResource.LETTER_G, 1, 8, 8, 1);
            Letter_H           = new CSprite(IDResource.LETTER_H, 1, 8, 8, 1);
            Letter_I           = new CSprite(IDResource.LETTER_I, 1, 8, 8, 1);
            Letter_J           = new CSprite(IDResource.LETTER_J, 1, 8, 8, 1);
            Letter_K           = new CSprite(IDResource.LETTER_K, 1, 8, 8, 1);
            Letter_L           = new CSprite(IDResource.LETTER_L, 1, 8, 8, 1);
            Letter_M           = new CSprite(IDResource.LETTER_M, 1, 8, 8, 1);
            Letter_N           = new CSprite(IDResource.LETTER_N, 1, 8, 8, 1);
            Letter_O           = new CSprite(IDResource.LETTER_O, 1, 8, 8, 1);
            Letter_P           = new CSprite(IDResource.LETTER_P, 1, 8, 8, 1);
            Letter_Q           = new CSprite(IDResource.LETTER_Q, 1, 8, 8, 1);
            Letter_R           = new CSprite(IDResource.LETTER_R, 1, 8, 8, 1);
            Letter_S           = new CSprite(IDResource.LETTER_S, 1, 8, 8, 1);
            Letter_T           = new CSprite(IDResource.LETTER_T, 1, 8, 8, 1);
            Letter_U           = new CSprite(IDResource.LETTER_U, 1, 8, 8, 1);
            Letter_V           = new CSprite(IDResource.LETTER_V, 1, 8, 8, 1);
            Letter_W           = new CSprite(IDResource.LETTER_W, 1, 8, 8, 1);
            Letter_X           = new CSprite(IDResource.LETTER_X, 1, 8, 8, 1);
            Letter_Y           = new CSprite(IDResource.LETTER_Y, 1, 8, 8, 1);
            Letter_Z           = new CSprite(IDResource.LETTER_Z, 1, 8, 8, 1);
            Letter_0           = new CSprite(IDResource.LETTER_0, 1, 8, 8, 1);
            Letter_1           = new CSprite(IDResource.LETTER_1, 1, 8, 8, 1);
            Letter_2           = new CSprite(IDResource.LETTER_2, 1, 8, 8, 1);
            Letter_3           = new CSprite(IDResource.LETTER_3, 1, 8, 8, 1);
            Letter_4           = new CSprite(IDResource.LETTER_4, 1, 8, 8, 1);
            Letter_5           = new CSprite(IDResource.LETTER_5, 1, 8, 8, 1);
            Letter_6           = new CSprite(IDResource.LETTER_6, 1, 8, 8, 1);
            Letter_7           = new CSprite(IDResource.LETTER_7, 1, 8, 8, 1);
            Letter_8           = new CSprite(IDResource.LETTER_8, 1, 8, 8, 1);
            Letter_9           = new CSprite(IDResource.LETTER_9, 1, 8, 8, 1);
            Letter_Multi       = new CSprite(IDResource.LETTER_MULTI, 1, 8, 8, 1);
            Letter_Dash        = new CSprite(IDResource.LETTER_DASH, 1, 8, 8, 1);
            Letter_Copy_Right  = new CSprite(IDResource.LETTER_COPY_RIGHT, 1, 8, 8, 1);
            Letter_Exclamation = new CSprite(IDResource.LETTER_EXCLAMATION, 1, 8, 8, 1);
            #endregion

            // Danh's code
            #region Intro
            m_Intro1 = new CSprite(IDResource.INTRO_1, 1, 368, 224, 1);
            m_Intro2 = new CSprite(IDResource.INTRO_2, 1, 368, 224, 1);
            m_Black  = new CSprite(IDResource.BLACK, 1, 368, 224, 1);
            #endregion
            #region Menu
            m_BGMenu        = new CSprite(IDResource.MENU, 1, 368, 224, 1);
            Btn_About       = new CSprite(IDResource.ABOUT_Btn, 1, 64, 8, 1);
            Btn_About_Act   = new CSprite(IDResource.ABOUT_Btn_Act, 1, 64, 8, 1);
            Btn_Exit        = new CSprite(IDResource.EXIT_Btn, 1, 64, 8, 1);
            Btn_Exit_Act    = new CSprite(IDResource.EXIT_Btn_Act, 1, 64, 8, 1);
            Btn_NewGame     = new CSprite(IDResource.NEWGAME_Btn, 1, 64, 8, 1);
            Btn_NewGame_Act = new CSprite(IDResource.NEWGAME_Btn_Act, 1, 64, 8, 1);
            Btn_Option      = new CSprite(IDResource.OPTION_Btn, 1, 64, 8, 1);
            Btn_Option_Act  = new CSprite(IDResource.OPTION_Btn_Act, 1, 64, 8, 1);
            Icon            = new CSprite(IDResource.ICON, 1, 8, 8, 1);
            Icon_Coin       = new CSprite(IDResource.ICON_COIN, 3, 8, 8, 3);
            #endregion
            #region Option
            m_BGOption      = new CSprite(IDResource.OPTION, 1, 368, 224, 1);
            Btn_Sound       = new CSprite(IDResource.SOUND_Btn, 1, 90, 20, 1);
            Btn_Sound_Act   = new CSprite(IDResource.SOUND_Btn_Act, 1, 90, 20, 1);
            Btn_Return      = new CSprite(IDResource.RETURN_Btn, 1, 390, 120, 1);
            Btn_Return_Act  = new CSprite(IDResource.RETURN_Btn_Act, 1, 90, 20, 1);
            Btn_BGSound     = new CSprite(IDResource.BGSOUND_Btn, 1, 90, 20, 1);
            Btn_BGSound_Act = new CSprite(IDResource.BGOUND_Btn_Act, 1, 90, 20, 1);
            m_BGAbout       = new CSprite(IDResource.ABOUTBG, 1, 368, 224, 1);
            #endregion
        }
 private void CheckShooted(GameTime _GameTime)
 {
     if (Status == IDStatus.SHOOTED)
     {
         Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ENEMY_HIDE_KOOPA_OW));
         //Console.WriteLine("xoay hinh");
         Sprite.Effect = SpriteEffects.FlipVertically;
         Sprite.Depth = GlobalValue.ENEMY_SPRITE_DEPTH;
     //}
     //if (Status == IDStatus.SHOOTED)
     //{
         m_Accel = new Vector2(0, 0.00098f);
         CoolDown += (float)_GameTime.ElapsedGameTime.TotalMilliseconds;
     }
 }
 private void UpCast(GameTime _GameTime)
 {
     if (IsUpCast)
     {
         m_CoolDownInvincible += (float)_GameTime.ElapsedGameTime.TotalMilliseconds;
         if (IDObject == IDObject.FIRE_MARIO)
         {
             Sprite = BigSprite[(int)m_CoolDownInvincible % 3];
         }
         if (IDObject == IDObject.SUPER_MARIO)
         {
             Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SUPER_MARIO));
             Sprite.Scale = new Vector2(1.0f, (float)rand.Next(1, 3)/3);
             Sprite.Origin = new Vector2(0, 32);
             Position = new Vector2(oldPosition.X, oldPosition.Y + 32);
         }
         if (m_CoolDownInvincible > GlobalValue.TRANSFORM_TIME)
         {
             //Status = IDStatus.MARIO_STAND;
             if (IDObject == IDObject.SUPER_MARIO)
             {
                 Position = oldPosition;
             }
             m_CoolDownInvincible = 0;
             Sprite = tempSprite;
             IsUpCast = false;
             GlobalValue.IS_LOCK_KEYBOARD = false;
             m_isMarioFreeze = false;
         }
     }
 }
 public CObject(IDObject _IDObject, Vector2 _Position)
 {
     m_IDObject = _IDObject;
     m_Position = _Position;
     m_StartPosition = m_Position;
     m_Sprite = null;
     //m_Status = IDStatus.ALIVE;
     m_IsAlive = true;
     m_IsVisible = false;
     m_IsColliable = true;
 }
        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);
        }
        public override void UpdateCollision(CAnimationObject _Object)
        {
            GlobalValue.ID_MARIO = IDObject;
            GlobalValue.MARIO_STATUS = Status;
            UpdateCollisionBullet(_Object);
            if (CheckCollision(_Object) != DirectCollision.NONE && m_Status != IDStatus.DIE)
            {
                switch (_Object.IDObject)
                {
                    #region Goomba
                    case IDObject.ENEMY_GOOMBA_OW:
                        if((CheckCollision(_Object) == DirectCollision.TOP || CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT || CheckCollision(_Object) == DirectCollision.BOTTOM) && IsInvincible && _Object.Status != IDStatus.SHOOTED)
                        {
                            _Object.Status = IDStatus.SHOOTED;
                            _Object.Velocity = new Vector2(0, -0.2f);
                        }
                        if (CheckCollision(_Object) == DirectCollision.TOP && _Object.Status == IDStatus.ALIVE && !IsWorldFreeze)
                        {
                            SoundManager.PlaySound(ESound.SFX_STOMP);
                            _Object.Status = IDStatus.BEFORE_DIE;
                            m_Velocity.Y = -m_Velocity.Y;
                            break;
                        }
                        if ((CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT) && _Object.Status == IDStatus.ALIVE && !IsWorldFreeze)
                        {
                            if (m_IDObject == IDObject.FIRE_MARIO)
                            {
                                SoundManager.PlaySound(ESound.SFX_MARIO_HURT);
                                Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SUPER_MARIO));
                                IDObject = IDObject.SUPER_MARIO;
                                Status = IDStatus.MARIO_DOWNCAST;
                                IsWorldFreeze = true;
                                break;
                            }
                            if (m_IDObject == IDObject.SUPER_MARIO)
                            {
                                SoundManager.PlaySound(ESound.SFX_MARIO_HURT);
                                Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SMALL_MARIO));
                                IsWorldFreeze = true;
                                Status = IDStatus.MARIO_DOWNCAST;
                                IDObject = IDObject.SMALL_MARIO;
                                break;
                            }
                            if (m_IDObject == IDObject.SMALL_MARIO)
                            {
                                m_Status = IDStatus.DIE;
                                break;
                            }
                            if (Direction == IDDir.RIGHT)
                            {
                                Position = new Vector2(Position.X - 5f, Position.Y);
                            }
                            if (Direction == IDDir.LEFT)
                            {
                                Position = new Vector2(Position.X + 5f, Position.Y);
                            }
                            Velocity = Vector2.Zero;
                        }
                        break;
                    #endregion
                    #region Soft Brick
                    case IDObject.MISC_SOFT_BRICK:
                        if (CheckCollision(_Object) == DirectCollision.TOP && _Object.Status != IDStatus.ACTIVATE && _Object.Status != IDStatus.DIE)
                        {
                            if (Status == IDStatus.MARIO_JUMP)
                            {
                                Status = IDStatus.MARIO_STAND;
                            }
                            m_IsJumping = false;
                            m_Velocity = new Vector2(m_Velocity.X, 0.0f);
                            m_Position.Y = _Object.Position.Y - Sprite.FrameHeight;
                            break;
                        }
                        else if (CheckCollision(_Object) == DirectCollision.BOTTOM && _Object.Status != IDStatus.ACTIVATE && _Object.Status != IDStatus.DIE)
                        {
                            m_Velocity = new Vector2(m_Velocity.X, 0.01f);
                            if (_Object.Status != IDStatus.MOVE)
                            {
                                _Object.Velocity = new Vector2(0, -0.04f);
                            }
                            m_Position.Y = _Object.Position.Y + _Object.Sprite.FrameHeight + 2f;
                            if (this.IDObject == Framework.IDObject.SMALL_MARIO)
                            {
                                _Object.Status = IDStatus.MOVE;
                                break;
                            }
                            if (this.IDObject == Framework.IDObject.FIRE_MARIO || this.IDObject == Framework.IDObject.SUPER_MARIO)
                            {
                                SoundManager.PlaySound(ESound.SFX_BREAKBLOCK);
                                _Object.Velocity = new Vector2(0, m_Velocity.Y - 1);
                                _Object.Status = IDStatus.BEFORE_DIE;
                                break;
                            }
                        }
                        else if (CheckCollision(_Object) == DirectCollision.LEFT)
                        {
                            m_Velocity = new Vector2(0.0f, m_Velocity.Y);
                            Position = new Vector2(_Object.Position.X - Sprite.FrameWidht - 1, Position.Y);
                            break;
                        }
                        else if (CheckCollision(_Object) == DirectCollision.RIGHT)
                        {
                            m_Velocity = new Vector2(0.0f, m_Velocity.Y);
                            Position = new Vector2(_Object.Position.X + _Object.Sprite.FrameWidht + 1, Position.Y);
                            break;
                        }
                        break;
                    #endregion
                    #region Item Coin
                    case IDObject.ITEM_COIN_NORMAL:
                        if ((CheckCollision(_Object) == DirectCollision.TOP || CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT) && _Object.Status == IDStatus.ALIVE)
                        {
                            SoundManager.PlaySound(ESound.SFX_COIN);
                            _Object.Status = IDStatus.DIE;
                            GlobalValue.MARIO_SCORE += 100;
                            GlobalValue.MARIO_COIN += 100;
                        }
                        break;
                    #endregion
                    #region Fire Flower
                    case IDObject.ITEM_FIRE_FLOWER:
                        if ((CheckCollision(_Object) == DirectCollision.TOP || CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT) && _Object.Status == IDStatus.ALIVE)
                        {
                            SoundManager.PlaySound(ESound.SFX_POWER_UP);
                            _Object.Status = IDStatus.DIE;
                            if (m_IDObject == IDObject.SMALL_MARIO || m_IDObject == IDObject.SUPER_MARIO)
                            {
                                if (IDObject == IDObject.SMALL_MARIO)
                                {
                                    m_Position.Y -= 16;
                                }
                                IDObject = IDObject.FIRE_MARIO;
                                m_Status = IDStatus.MARIO_UPCAST;
                                tempSprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.FIRE_MARIO));
                                IsWorldFreeze = true;
                                GlobalValue.IS_LOCK_KEYBOARD = true;
                                m_isMarioFreeze = true;
                            }
                            GlobalValue.MARIO_SCORE += 1000;
                            break;
                        }
                        break;
                    case IDObject.ITEM_SUPER_MUSHROOM:
                        if ((CheckCollision(_Object) == DirectCollision.TOP || CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT))
                        {
                            SoundManager.PlaySound(ESound.SFX_POWER_UP);
                            _Object.Status = IDStatus.DIE;
                            if (m_IDObject == IDObject.SMALL_MARIO)
                            {
                                m_Position.Y -= 16;
                                IDObject = IDObject.SUPER_MARIO;
                                m_Status = IDStatus.MARIO_UPCAST;
                                tempSprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SUPER_MARIO));
                                IsWorldFreeze = true;
                                GlobalValue.IS_LOCK_KEYBOARD = true;
                                m_isMarioFreeze = true;
                                oldPosition = Position;
                            }
                            GlobalValue.MARIO_SCORE += 1000;
                            break;
                        }
                        break;
                    case IDObject.ITEM_1UP_MUSHROOM:
                        if ((CheckCollision(_Object) == DirectCollision.TOP || CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT))
                        {
                            SoundManager.PlaySound(ESound.SFX_1_UP);
                            _Object.Status = IDStatus.DIE;
                            ++GlobalValue.MARIO_LIFE;
                            break;
                        }
                        break;
                    #endregion
                    #region Case Koopa
                    case IDObject.ENEMY_KOOPA_OW:
                        if ((CheckCollision(_Object) == DirectCollision.TOP || CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT || CheckCollision(_Object) == DirectCollision.BOTTOM) && IsInvincible && _Object.Status != IDStatus.SHOOTED)
                        {
                            _Object.Status = IDStatus.SHOOTED;
                            _Object.Velocity = new Vector2(0, -0.2f);
                        }
                        if (CheckCollision(_Object) == DirectCollision.TOP && _Object.Status == IDStatus.ALIVE )
                        {
                            m_Velocity.Y = -0.02f;
                            _Object.Status = IDStatus.HIDE;
                            _Object.Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.ENEMY_HIDE_KOOPA_OW));
                        }
                        if ((CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT) && _Object.Status == IDStatus.HIDE)
                        {
                            if (Direction == IDDir.LEFT && CheckCollision(_Object) == DirectCollision.RIGHT)
                            {
                                _Object.Direction = IDDir.LEFT;
                                _Object.Status = IDStatus.SPIN;
                                SoundManager.PlaySound(ESound.SFX_KICK);
                                break;
                            }
                            if (Direction == IDDir.RIGHT && CheckCollision(_Object) == DirectCollision.LEFT)
                            {
                                _Object.Direction = IDDir.RIGHT;
                                _Object.Status = IDStatus.SPIN;
                                SoundManager.PlaySound(ESound.SFX_KICK);
                                break;
                            }
                            break;
                        }
                        if (CheckCollision(_Object) == DirectCollision.TOP && _Object.Status == IDStatus.HIDE)
                        {
                            if (Status == IDStatus.MARIO_JUMP)
                            {
                                Status = IDStatus.MARIO_STAND;
                            }
                            m_Velocity.Y = 0;
                            //m_IsDisableUp = true;
                            IsJumping = false;
                            break;
                        }
                        if (CheckCollision(_Object) == DirectCollision.TOP && _Object.Status == IDStatus.SPIN)
                        {
                            if (Status == IDStatus.MARIO_JUMP)
                            {
                                Status = IDStatus.MARIO_STAND;
                            }
                            m_Velocity.Y = 0;
                            IsJumping = false;
                            _Object.Status = IDStatus.HIDE;
                            break;
                        }
                        if ((CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT) && _Object.Status == IDStatus.SPIN && !IsWorldFreeze)
                        {
                            if (m_IDObject == IDObject.FIRE_MARIO)
                            {
                                SoundManager.PlaySound(ESound.SFX_MARIO_HURT);
                                IDObject = IDObject.SUPER_MARIO;
                                IsWorldFreeze = true;
                                Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SUPER_MARIO));
                                Status = IDStatus.MARIO_DOWNCAST;
                                break;
                            }
                            if (m_IDObject == IDObject.SUPER_MARIO)
                            {
                                SoundManager.PlaySound(ESound.SFX_MARIO_HURT);
                                IDObject = IDObject.SMALL_MARIO;
                                Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SMALL_MARIO));
                                IsWorldFreeze = true;
                                Status = IDStatus.MARIO_DOWNCAST;
                                break;
                            }
                            if (m_IDObject == IDObject.SMALL_MARIO)
                            {
                                //m_Velocity.Y = -3.0f;
                                m_Status = IDStatus.DIE;
                                break;
                            }
                        }
                        if ((CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT) && _Object.Status == IDStatus.ALIVE && !IsWorldFreeze)
                        {
                            if (m_IDObject == IDObject.FIRE_MARIO)
                            {
                                SoundManager.PlaySound(ESound.SFX_MARIO_HURT);
                                IDObject = IDObject.SUPER_MARIO;
                                Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SUPER_MARIO));
                                IsWorldFreeze = true;
                                Status = IDStatus.MARIO_DOWNCAST;
                                break;
                            }
                            if (m_IDObject == IDObject.SUPER_MARIO)
                            {
                                SoundManager.PlaySound(ESound.SFX_MARIO_HURT);
                                IDObject = IDObject.SMALL_MARIO;
                                Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SMALL_MARIO));
                                IsWorldFreeze = true;
                                Status = IDStatus.MARIO_DOWNCAST;
                                break;
                            }
                            if (m_IDObject == IDObject.SMALL_MARIO)
                            {
                                m_Status = IDStatus.DIE;
                                break;
                            }
                        }
                        break;
                    #endregion
                    #region Case Base Brick
                    case IDObject.MISC_BASE_BRICK:
                    case IDObject.MISC_HARD_BRICK:
                        if (CheckCollision(_Object) == DirectCollision.TOP)
                        {
                            //if (Status != IDStatus.MARIO_RUN && Status != IDStatus.MARIO_STAND && Status != IDStatus.MARIO_ATTACK && Status != IDStatus.MARIO_STRIPPED && Status != IDStatus.MARIO_WIN && Status != IDStatus.MARIO_AUTO_RUN && Status != IDStatus.MARIO_DOWNCAST)
                            if(Status == IDStatus.MARIO_JUMP)
                            {
                                Status = IDStatus.MARIO_STAND;
                            }
                            //m_IsDisableUp = false;
                            m_IsJumping = false;
                            m_Velocity = new Vector2(m_Velocity.X, 0.0f);
                            m_Position.Y = _Object.Position.Y - Sprite.FrameHeight;
                            if (Status == IDStatus.MARIO_STRIPPED)
                            {
                                Position = new Vector2(Position.X + 12, Position.Y);
                                Console.WriteLine(Status.ToString());
                                Direction = IDDir.LEFT;
                                Status = IDStatus.MARIO_WIN;
                            }
                            break;
                        }
                        else if (CheckCollision(_Object) == DirectCollision.BOTTOM)
                        {
                            m_Velocity = new Vector2(m_Velocity.X, 0.0098f);
                            m_Position.Y = _Object.Position.Y + _Object.Sprite.FrameHeight + 1;
                            break;
                        }
                        else if (CheckCollision(_Object) == DirectCollision.LEFT)
                        {
                            m_Velocity = new Vector2(0.0f, m_Velocity.Y);
                            Position = new Vector2(Position.X - 0.05f, Position.Y);
                            break;
                        }
                        else if (CheckCollision(_Object) == DirectCollision.RIGHT)
                        {
                            m_Velocity = new Vector2(0.0f, m_Velocity.Y);
                            Position = new Vector2(Position.X + 0.05f, Position.Y);
                            break;
                        }
                        break;
                        #endregion
                    #region Goal Pole
                    case IDObject.MISC_GOAL_POLE:
                        if ((CheckCollision(_Object) == DirectCollision.BOTTOM || CheckCollision(_Object) == DirectCollision.LEFT || CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.TOP) && !GlobalValue.IS_LOCK_KEYBOARD)
                        {
                            if (!GlobalValue.IS_LOCK_KEYBOARD)
                            {
                                Position = new Vector2(_Object.Position.X - 9, Position.Y);
                                SoundManager.PlaySound(ESound.SFX_FLAGPOLE);
                                MediaPlayer.Stop();
                            }
                            GlobalValue.KillBoss = true;
                            Status = IDStatus.MARIO_STRIPPED;
                            GlobalValue.IS_LOCK_KEYBOARD = true;
                            Accel = Vector2.Zero;
                            Velocity = Vector2.Zero;
                            _Object.Status = IDStatus.ACTIVATE;
                        }
                        break;
                    #endregion
                    #region Pipe
                    //case IDObject.MISC_IN_PORTAL_PIPE:
                    //    if (CheckCollision(_Object) == DirectCollision.TOP)
                    //    {
                    //        if (Status == IDStatus.MARIO_JUMP)
                    //        {
                    //            Status = IDStatus.MARIO_STAND;
                    //        }
                    //        if (Status != IDStatus.TELEPORT)
                    //        {
                    //            m_IsJumping = false;
                    //            m_Velocity = new Vector2(m_Velocity.X, 0.0f);
                    //            m_Position.Y = _Object.Position.Y - Sprite.FrameHeight;
                    //        }
                    //        break;
                    //    }
                    //    if (CheckCollision(_Object) == DirectCollision.LEFT)
                    //    {
                    //        m_Velocity = new Vector2(0.0f, m_Velocity.Y);
                    //        Position = new Vector2(Position.X - 0.05f, Position.Y);
                    //        break;
                    //    }
                    //    else if (CheckCollision(_Object) == DirectCollision.RIGHT)
                    //    {
                    //        m_Velocity = new Vector2(0.0f, m_Velocity.Y);
                    //        Position = new Vector2(Position.X + 0.05f, Position.Y);
                    //        break;
                    //    }
                    //    break;
                    case IDObject.MISC_STOCK_PIPE:
                    case IDObject.MISC_GATE_PIPE:
                    //case IDObject.MISC_NORMAL_PIPE:
                    //case IDObject.MISC_OUT_2_PIPE:
                        if (CheckCollision(_Object) == DirectCollision.TOP)
                        {
                            if (Status != IDStatus.TELEPORT)
                            {
                                if (Status == IDStatus.MARIO_JUMP)
                                {
                                    Status = IDStatus.MARIO_STAND;
                                }
                                m_IsJumping = false;
                                m_Velocity = new Vector2(m_Velocity.X, 0.0f);
                                m_Position.Y = _Object.Position.Y - Sprite.FrameHeight;
                                break;
                            }
                        }
                        //if (CheckCollision(_Object) == DirectCollision.BOTTOM)
                        //{
                        //    m_Velocity = new Vector2(m_Velocity.X, 0.0098f);
                        //    m_Position.Y = _Object.Position.Y + _Object.Sprite.FrameHeight + 1;
                        //    break;
                        //}
                        else if (CheckCollision(_Object) == DirectCollision.LEFT)
                        {
                            if (Status != IDStatus.TELEPORT)
                            {
                                m_Velocity = new Vector2(0.0f, m_Velocity.Y);
                                Position = new Vector2(Position.X - 0.05f, Position.Y);
                                break;
                            }
                        }
                        else if (CheckCollision(_Object) == DirectCollision.RIGHT)
                        {
                            if (Status != IDStatus.TELEPORT)
                            {
                                m_Velocity = new Vector2(0.0f, m_Velocity.Y);
                                Position = new Vector2(Position.X + 0.05f, Position.Y);
                                break;
                            }
                        }
                        break;
                    //case IDObject.MISC_OUT_1_PIPE:
                    //    if (CheckCollision(_Object) == DirectCollision.TOP && Status != IDStatus.MARIO_AUTO_RUN)
                    //    {
                    //        if (Status == IDStatus.MARIO_JUMP)
                    //        {
                    //            Status = IDStatus.MARIO_STAND;
                    //        }
                    //        m_IsJumping = false;
                    //        m_Velocity = new Vector2(m_Velocity.X, 0.0f);
                    //        m_Position.Y = _Object.Position.Y - Sprite.FrameHeight;
                    //        break;
                    //    }
                        //if (CheckCollision(_Object) == DirectCollision.LEFT && Status != IDStatus.MARIO_AUTO_RUN && Status != IDStatus.TELEPORT && Position.Y >= _Object.Position.Y)
                        //{
                        //    Velocity = Vector2.Zero;
                        //    Accel = Vector2.Zero;
                        //    SoundManager.PlaySound(ESound.SFX_PIPE);
                        //    Sprite.Depth = 0.05f;
                        //    Status = IDStatus.MARIO_AUTO_RUN;
                        //    GlobalValue.IS_LOCK_KEYBOARD = true;
                        //}
                        //break;
                    #endregion
                    #region Question Brick
                    case IDObject.MISC_QUESTION_BRICK:
                    if (CheckCollision(_Object) == DirectCollision.TOP)
                        {
                            if (Status == IDStatus.MARIO_JUMP)
                            {
                                Status = IDStatus.MARIO_STAND;
                            }
                            m_IsJumping = false;
                            m_Velocity = new Vector2(m_Velocity.X, 0.0f);
                            m_Position.Y = _Object.Position.Y - Sprite.FrameHeight;
                            break;
                        }
                        else if (CheckCollision(_Object) == DirectCollision.BOTTOM)
                        {
                            m_Velocity = new Vector2(m_Velocity.X, 0.0098f);
                            m_Position.Y = _Object.Position.Y + _Object.Sprite.FrameHeight + 1;
                            if (_Object.Status != IDStatus.UNACTIVATE)
                            {
                                _Object.Status = IDStatus.DEACTIVATE;
                            }
                            break;
                        }
                        else if (CheckCollision(_Object) == DirectCollision.LEFT)
                        {
                            m_Velocity = new Vector2(0.0f, m_Velocity.Y);
                            break;
                        }
                        else if (CheckCollision(_Object) == DirectCollision.RIGHT)
                        {
                            m_Velocity = new Vector2(0.0f, m_Velocity.Y);
                            break;
                        }
                        break;
                    #endregion
                    #region Case Starman
                    case IDObject.ITEM_STARMAN:
                        if ((CheckCollision(_Object) == DirectCollision.TOP || CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT || CheckCollision(_Object) == DirectCollision.BOTTOM) && _Object.Status != IDStatus.UNACTIVATE)
                        {
                            SoundManager.PlaySound(ESound.SFX_POWER_UP);
                            Status = IDStatus.MARIO_INVINCIBLE;
                            tempSprite = Sprite;
                            _Object.Status = IDStatus.DIE;

                            break;
                        }
                        break;
                    #endregion
                    case IDObject.ENEMY_BOSS:
                        if ((CheckCollision(_Object) == DirectCollision.RIGHT || CheckCollision(_Object) == DirectCollision.LEFT) && !IsWorldFreeze)
                        {
                            if (m_IDObject == IDObject.FIRE_MARIO)
                            {
                                SoundManager.PlaySound(ESound.SFX_MARIO_HURT);
                                Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SUPER_MARIO));
                                IDObject = IDObject.SUPER_MARIO;
                                Status = IDStatus.MARIO_DOWNCAST;
                                IsWorldFreeze = true;
                                break;
                            }
                            if (m_IDObject == IDObject.SUPER_MARIO)
                            {
                                SoundManager.PlaySound(ESound.SFX_MARIO_HURT);
                                Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SMALL_MARIO));
                                IsWorldFreeze = true;
                                Status = IDStatus.MARIO_DOWNCAST;
                                IDObject = IDObject.SMALL_MARIO;
                                break;
                            }
                            if (m_IDObject == IDObject.SMALL_MARIO)
                            {
                                m_Status = IDStatus.DIE;
                                break;
                            }
                            if (Direction == IDDir.RIGHT)
                            {
                                Position = new Vector2(Position.X - 5f, Position.Y);
                            }
                            if (Direction == IDDir.LEFT)
                            {
                                Position = new Vector2(Position.X + 5f, Position.Y);
                            }
                            Velocity = Vector2.Zero;
                        }
                        break;
                    case IDObject.ENEMY_BOSS_BULLET:
                        if (CheckCollision(_Object) != DirectCollision.NONE && !IsWorldFreeze)
                        {
                            if (m_IDObject == IDObject.FIRE_MARIO)
                            {
                                SoundManager.PlaySound(ESound.SFX_MARIO_HURT);
                                Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SUPER_MARIO));
                                IDObject = IDObject.SUPER_MARIO;
                                Status = IDStatus.MARIO_DOWNCAST;
                                IsWorldFreeze = true;
                                break;
                            }
                            if (m_IDObject == IDObject.SUPER_MARIO)
                            {
                                SoundManager.PlaySound(ESound.SFX_MARIO_HURT);
                                Sprite = new CSprite(CResourceManager.GetInstance().GetResource(IDResource.SMALL_MARIO));
                                IsWorldFreeze = true;
                                Status = IDStatus.MARIO_DOWNCAST;
                                IDObject = IDObject.SMALL_MARIO;
                                break;
                            }
                            if (m_IDObject == IDObject.SMALL_MARIO)
                            {
                                m_Status = IDStatus.DIE;
                                break;
                            }
                            if (Direction == IDDir.RIGHT)
                            {
                                Position = new Vector2(Position.X - 5f, Position.Y);
                            }
                            if (Direction == IDDir.LEFT)
                            {
                                Position = new Vector2(Position.X + 5f, Position.Y);
                            }
                            Velocity = Vector2.Zero;
                        }
                        break;
                    #region Case Default
                    default:
                        break;
                    #endregion
                }
            }
            base.UpdateCollision(_Object);
        }
        private CResourceManager()
        {
            #region CSprite
            Sprite_Small_Mario = new CSprite(IDResource.SMALL_MARIO, 9, 16, 16, 9);
            Sprite_Super_Mario = new CSprite(IDResource.SUPER_MARIO, 9, 16, 32, 9);
            Sprite_Fire_Mario = new CSprite(IDResource.FIRE_MARIO, 9, 16, 32, 9);
            Sprite_Big_Invi = new CSprite(IDResource.BIG_MARIO_INVICIBILITY, 9, 16, 32, 9);
            Sprite_Big_Invi2 = new CSprite(IDResource.BIG_MARIO_INVICIBILITY2, 9, 16, 32, 9);
            Sprite_Big_Invi3 = new CSprite(IDResource.BIG_MARIO_INVICIBILITY3, 9, 16, 32, 9);
            Sprite_Small_Invi = new CSprite(IDResource.SMALL_MARIO_INVICIBILITY, 9, 16, 16, 9);
            Sprite_Small_Invi2 = new CSprite(IDResource.SMALL_MARIO_INVICIBILITY2, 9, 16, 16, 9);
            Sprite_Small_Invi3 = new CSprite(IDResource.SMALL_MARIO_INVICIBILITY3, 9, 16, 16, 9);
            Sprite_Base_Brick = new CSprite(IDResource.MISC_BASE_BRICK, 1, 16, 16, 7);
            Sprite_Question_Brick = new CSprite(IDResource.MISC_QUESTION_BRICK, 4, 16, 16, 4);
            Sprite_Iron_Brick = new CSprite(IDResource.MISC_IRON_BRICK, 1, 16, 16, 1);
            Sprite_Activated_Coin = new CSprite(IDResource.ITEM_COIN_ACTIVATED, 4, 16, 16, 4);
            Sprite_Normal_Coin = new CSprite(IDResource.ITEM_COIN_NORMAL, 4, 16, 16, 4);
            Sprite_Fire_Flower = new CSprite(IDResource.ITEM_FIRE_FLOWER, 4, 16, 16, 4);
            Sprite_Super_Mushroom = new CSprite(IDResource.ITEM_SUPER_MUSHROOM, 4, 16, 16, 4);
            Sprite_1_Up_Mushroom = new CSprite(IDResource.ITEM_1UP_MUSHROOM, 4, 16, 16, 4);
            Sprite_Starman = new CSprite(IDResource.ITEM_STARMAN, 4, 16, 16, 4);
            Sprite_GoomBa_OW = new CSprite(IDResource.ENEMY_GOOMBA_OW, 3, 16, 16, 3);
            Sprite_Koopa_OW = new CSprite(IDResource.ENEMY_KOOPA_OW, 6, 16, 24, 6);
            Sprite_Piece_1 = new CSprite(IDResource.MISC_PIECE_1, 1, 16, 16, 1);
            Sprite_Piece_2 = new CSprite(IDResource.MISC_PIECE_2, 1, 16, 16, 1);
            Sprite_Soft_Brick = new CSprite(IDResource.MISC_SOFT_BRICK, 1, 16, 16, 1);
            Sprite_Stock_Pipe = new CSprite(IDResource.MISC_STOCK_PIPE, 1, 32, 16, 1);
            Sprite_Gate_Pipe = new CSprite(IDResource.MISC_GATE_PIPE, 1, 32, 16, 1);
            Sprite_Up_Pipe = new CSprite(IDResource.MISC_UP_PIPE, 1, 62, 32, 1);
            Sprite_Big_Grass = new CSprite(IDResource.MISC_BIG_GRASS, 1, 64, 16, 1);
            Sprite_Medium_Grass = new CSprite(IDResource.MISC_MEDIUM_GRASS, 1, 48, 16, 1);
            Sprite_Small_Grass = new CSprite(IDResource.MISC_SMALL_GRASS, 1, 32, 16, 1);
            Sprite_Medium_Mountain = new CSprite(IDResource.MISC_MEDIUM_MOUNTAIN, 1, 48, 24, 1);
            Sprite_Big_Mountain = new CSprite(IDResource.MISC_BIG_MOUNTAIN, 1, 80, 35, 1);
            Sprite_Hard_Brick = new CSprite(IDResource.MISC_HARD_BRICK, 1, 16, 16, 1);
            Sprite_Hide_Koopa_OW = new CSprite(IDResource.ENEMY_HIDE_KOOPA_OW, 2, 16, 16, 2);
            Sprite_Bullet = new CSprite(IDResource.BULLET, 4, 8, 8, 2);
            Sprite_Goal_Pole = new CSprite(IDResource.MISC_GOAL_POLE, 1, 8, 136, 1);
            Sprite_Flag = new CSprite(IDResource.MISC_FLAG, 1, 16, 16, 1);
            Sprite_Castle = new CSprite(IDResource.MISC_CASTLE, 1, 80, 80, 1);
            Sprite_Star_Flag_Castle = new CSprite(IDResource.MISC_STAR_FLAG_CASTLE, 1, 16, 32, 1);
            Sprite_Firework = new CSprite(IDResource.MISC_FIREWORK, 3, 16, 16, 1);

            BG_GameOver = new CSprite(IDResource.GAME_OVER, 1, 368, 224, 1);
            BG_LoadGame = new CSprite(IDResource.LOAD, 1, 368, 224, 1);
            Sprite_Small_Clound = new CSprite(IDResource.MISC_SMALL_CLOUND, 1, 32, 24, 1);
            Sprite_Medium_Clound = new CSprite(IDResource.MISC_MEDIUM_CLOUND, 1, 48, 24, 1);
            Sprite_Big_Clound = new CSprite(IDResource.MISC_BIG_CLOUND, 1, 64, 24, 1);
            Sprite_Boss = new CSprite(IDResource.ENEMY_BOSS, 4, 32, 32, 4);
            Sprite_Boss_Bullet = new CSprite(IDResource.ENEMY_BOSS_BULLET, 2, 24, 8, 1);
            #endregion

            #region Letter
            Letter_A = new CSprite(IDResource.LETTER_A, 1, 8, 8, 1);
            Letter_B = new CSprite(IDResource.LETTER_B, 1, 8, 8, 1);
            Letter_C = new CSprite(IDResource.LETTER_C, 1, 8, 8, 1);
            Letter_D = new CSprite(IDResource.LETTER_D, 1, 8, 8, 1);
            Letter_E = new CSprite(IDResource.LETTER_E, 1, 8, 8, 1);
            Letter_F = new CSprite(IDResource.LETTER_F, 1, 8, 8, 1);
            Letter_G = new CSprite(IDResource.LETTER_G, 1, 8, 8, 1);
            Letter_H = new CSprite(IDResource.LETTER_H, 1, 8, 8, 1);
            Letter_I = new CSprite(IDResource.LETTER_I, 1, 8, 8, 1);
            Letter_J = new CSprite(IDResource.LETTER_J, 1, 8, 8, 1);
            Letter_K = new CSprite(IDResource.LETTER_K, 1, 8, 8, 1);
            Letter_L = new CSprite(IDResource.LETTER_L, 1, 8, 8, 1);
            Letter_M = new CSprite(IDResource.LETTER_M, 1, 8, 8, 1);
            Letter_N = new CSprite(IDResource.LETTER_N, 1, 8, 8, 1);
            Letter_O = new CSprite(IDResource.LETTER_O, 1, 8, 8, 1);
            Letter_P = new CSprite(IDResource.LETTER_P, 1, 8, 8, 1);
            Letter_Q = new CSprite(IDResource.LETTER_Q, 1, 8, 8, 1);
            Letter_R = new CSprite(IDResource.LETTER_R, 1, 8, 8, 1);
            Letter_S = new CSprite(IDResource.LETTER_S, 1, 8, 8, 1);
            Letter_T = new CSprite(IDResource.LETTER_T, 1, 8, 8, 1);
            Letter_U = new CSprite(IDResource.LETTER_U, 1, 8, 8, 1);
            Letter_V = new CSprite(IDResource.LETTER_V, 1, 8, 8, 1);
            Letter_W = new CSprite(IDResource.LETTER_W, 1, 8, 8, 1);
            Letter_X = new CSprite(IDResource.LETTER_X, 1, 8, 8, 1);
            Letter_Y = new CSprite(IDResource.LETTER_Y, 1, 8, 8, 1);
            Letter_Z = new CSprite(IDResource.LETTER_Z, 1, 8, 8, 1);
            Letter_0 = new CSprite(IDResource.LETTER_0, 1, 8, 8, 1);
            Letter_1 = new CSprite(IDResource.LETTER_1, 1, 8, 8, 1);
            Letter_2 = new CSprite(IDResource.LETTER_2, 1, 8, 8, 1);
            Letter_3 = new CSprite(IDResource.LETTER_3, 1, 8, 8, 1);
            Letter_4 = new CSprite(IDResource.LETTER_4, 1, 8, 8, 1);
            Letter_5 = new CSprite(IDResource.LETTER_5, 1, 8, 8, 1);
            Letter_6 = new CSprite(IDResource.LETTER_6, 1, 8, 8, 1);
            Letter_7 = new CSprite(IDResource.LETTER_7, 1, 8, 8, 1);
            Letter_8 = new CSprite(IDResource.LETTER_8, 1, 8, 8, 1);
            Letter_9 = new CSprite(IDResource.LETTER_9, 1, 8, 8, 1);
            Letter_Multi = new CSprite(IDResource.LETTER_MULTI, 1, 8, 8, 1);
            Letter_Dash = new CSprite(IDResource.LETTER_DASH, 1, 8, 8, 1);
            Letter_Copy_Right = new CSprite(IDResource.LETTER_COPY_RIGHT, 1, 8, 8, 1);
            Letter_Exclamation = new CSprite(IDResource.LETTER_EXCLAMATION, 1, 8, 8, 1);
            #endregion

            #region Intro
            m_Intro1 = new CSprite(IDResource.INTRO_1, 1, 368, 224, 1);
            m_Intro2 = new CSprite(IDResource.INTRO_2, 1, 368, 224, 1);
            m_Black = new CSprite(IDResource.BLACK, 1, 368, 224, 1);
            #endregion
            #region Menu
            m_BGMenu = new CSprite(IDResource.MENU, 1, 368, 224, 1);
            Btn_About = new CSprite(IDResource.ABOUT_Btn, 1, 64, 8, 1);
            Btn_About_Act = new CSprite(IDResource.ABOUT_Btn_Act, 1, 64, 8, 1);
            Btn_Exit = new CSprite(IDResource.EXIT_Btn, 1, 64, 8, 1);
            Btn_Exit_Act = new CSprite(IDResource.EXIT_Btn_Act, 1, 64, 8, 1);
            Btn_NewGame = new CSprite(IDResource.NEWGAME_Btn, 1, 64, 8, 1);
            Btn_NewGame_Act = new CSprite(IDResource.NEWGAME_Btn_Act, 1, 64, 8, 1);
            Btn_Option = new CSprite(IDResource.OPTION_Btn, 1, 64, 8, 1);
            Btn_Option_Act = new CSprite(IDResource.OPTION_Btn_Act, 1, 64, 8, 1);
            Icon = new CSprite(IDResource.ICON, 1, 8, 8, 1);
            Icon_Coin = new CSprite(IDResource.ICON_COIN, 3, 8, 8, 3);
            #endregion
            #region Option
            m_BGOption = new CSprite(IDResource.OPTION, 1, 368, 224, 1);
            Btn_Sound = new CSprite(IDResource.SOUND_Btn, 1, 90, 20, 1);
            Btn_Sound_Act = new CSprite(IDResource.SOUND_Btn_Act, 1, 90, 20, 1);
            Btn_Return = new CSprite(IDResource.RETURN_Btn, 1, 390, 120, 1);
            Btn_Return_Act = new CSprite(IDResource.RETURN_Btn_Act, 1, 90, 20, 1);
            Btn_BGSound = new CSprite(IDResource.BGSOUND_Btn, 1, 90, 20, 1);
            Btn_BGSound_Act = new CSprite(IDResource.BGOUND_Btn_Act, 1, 90, 20, 1);
            m_BGAbout = new CSprite(IDResource.ABOUTBG, 1, 368, 224, 1);
            #endregion
        }