Пример #1
0
        public static void DrawDeathScreenText(SpriteBatch spriteBatch, SpriteFont font)
        {
            xOffSet = GlobalVariables.CameraXPos + (int)(GlobalVariables.CameraWidth * 0.46);
            yOffSet = (int)(GlobalVariables.CameraHeight * 0.45);
            Mario staticMario = new Mario(xOffSet, yOffSet);

            staticMario.Draw();

            xOffSet = GlobalVariables.CameraXPos + (int)(GlobalVariables.CameraWidth * 0.50);
            yOffSet = (int)(GlobalVariables.CameraHeight * 0.45);
            string lifeCount = "x " + GlobalVariables.FirstPlayerLives.ToString();

            spriteBatch.DrawString(font, lifeCount, new Vector2(xOffSet, yOffSet), Color.White);
        }
Пример #2
0
        protected override void LoadContent()
        {
            SpriteBatch = new SpriteBatch(GraphicsDevice);

            Texture                 = Content.Load <Texture2D>("MarioSheet");
            BackgroundMusic         = Content.Load <Song>("backgroundMusic");
            pauseSoundEffect        = Content.Load <SoundEffect>("pauseSoundEffect");
            blackHole               = Content.Load <Texture2D>("blackholeSprite");
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume      = 0.6f;
            SpriteFactory.LoadAllTextures(Content);
            Block = new BlockLogic(this);
            Mario.LoadContent(Content);
            World = new WorldManager(this);
            World.Load();
            PlayerStat = new PlayerStatistic(SpriteBatch, Content);

            KeyboardController = new KeyboardController();
            KeyboardController.RegisterCommand(Keys.Left, new MarioLookLeftCommand(this));
            KeyboardController.RegisterCommand(Keys.Right, new MarioLookRightCommand(this));
            KeyboardController.RegisterCommand(Keys.Down, new MarioLookDownCommand(this));
            KeyboardController.RegisterCommand(Keys.A, new MarioLookLeftCommand(this));
            KeyboardController.RegisterCommand(Keys.D, new MarioLookRightCommand(this));
            KeyboardController.RegisterCommand(Keys.S, new MarioLookDownCommand(this));
            KeyboardController.RegisterCommand(Keys.Z, new MarioJumpCommand(this));
            KeyboardController.RegisterCommand(Keys.Q, new QuitCommand(this));
            KeyboardController.RegisterCommand(Keys.R, new ResetCommand(this));
            KeyboardController.RegisterCommand(Keys.X, new MarioRunCommand(this));

            GamepadController = new GamepadController();
            GamepadController.RegisterCommand(Buttons.LeftThumbstickLeft, new MarioLookLeftCommand(this));
            GamepadController.RegisterCommand(Buttons.LeftThumbstickRight, new MarioLookRightCommand(this));
            GamepadController.RegisterCommand(Buttons.LeftThumbstickDown, new MarioLookDownCommand(this));
            GamepadController.RegisterCommand(Buttons.X, new ResetCommand(this));
            GamepadController.RegisterCommand(Buttons.A, new MarioJumpCommand(this));
            GamepadController.RegisterCommand(Buttons.B, new MarioRunCommand(this));

            MouseController = new MouseController();
            MouseController.RegisterCommand("LeftMouseClick", new MarioRunCommand(this));
            MouseController.RegisterCommand("RightMouseClick", new MarioJumpCommand(this));
        }
Пример #3
0
 public ManageJump(Mario mario)
 {
     mainMario = mario;
     physics   = mario.Physics;
 }