Exemple #1
0
 public Mario(int x = 0, int y = 0)
 {
     Name             = "MARIO";
     Lives            = HotDAMN.INITIAL_LIVES_COUNT;
     Position         = new Vector2(x, y);
     Velocity         = Vector2.Zero;
     Acceleration     = Physics.GRAVITY;
     Hitbox           = new Hitbox(Hitboxes.SMALL_MARIO_IDLE_OFFSET_X, Hitboxes.SMALL_MARIO_IDLE_OFFSET_Y);
     State            = HUD.MarioState(this, HUD.setting);
     Sprite           = new MarioAnimation(HUD.currentPlayer == 0 ? Textures.mario0 : Textures.luigi0, Textures.smallRightIdle);
     IsActive         = true;
     Decorator        = new PlainPlayer(this);
     CollisionHandler = new PlayerCollisionHandler(this);
     IsRunning        = false;
 }
        public void Draw(SpriteBatch sb)
        {
            String text = HotDAMN.TEXT_WORLD + levelName.Replace('0', ' ');

            Vector2         textSize   = Textures.font.MeasureString(text);
            Vector2         textCenter = new Vector2(Game.GraphicsDevice.Viewport.Width / 2, (Game.GraphicsDevice.Viewport.Height / 2) - 35);
            IAnimatedSprite background = new BackgroundAnimation(Color.Black);
            IAnimatedSprite mario      = new MarioAnimation(HUD.currentPlayer == 0 ? Textures.mario0 : Textures.luigi0, Textures.smallRightIdle);

            background.Draw(sb, 0, 0);
            mario.Draw(sb, (int)(textCenter.X - (textSize.X / 2)) + 15, (int)(textCenter.Y - (textSize.Y / 2)) + 25);
            sb.DrawString(Textures.font, HotDAMN.TEXT_X, new Vector2(textCenter.X - (textSize.X / 2) + 35, textCenter.Y - (textSize.Y / 2) + 43), Color.White);
            sb.DrawString(Textures.font, HUD.LIVES[HUD.currentPlayer].ToString(), new Vector2(textCenter.X - (textSize.X / 2) + 55, textCenter.Y - (textSize.Y / 2) + 43), Color.White);


            sb.DrawString(Textures.font, text, textCenter - (textSize / 2), Color.White);

            HUD.Draw(sb, levelName);
        }