コード例 #1
0
ファイル: Game1.cs プロジェクト: alec-bell/MarioGame
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            BoundingBox.Init(spriteBatch, this.GraphicsDevice);

            //instantiate our keyboard and gamepad classes
            keyboardController = new KeyboardController(keysMap);
            for (int i = 0; i < 4; i++)
            {
                controllerArray[i] = new GamepadController(buttonsMap, i);
            }

            background = Content.Load <Texture2D>("MarioBackground");

            SpriteFactory.Init(Content);
        }
コード例 #2
0
        public static KeyboardController SetupMenuKeyboard(Menu menu, Scene scene)
        {
            KeyboardController keyboard = new KeyboardController();

            // Add system commands here
            keyboard.AddSystemCommand((int)Keys.Q, new QuitCommand(scene));

            // Add player commands here
            keyboard.AddSystemCommand((int)Keys.Up, new ScrollUpCommand(menu));
            keyboard.AddSystemCommand((int)Keys.Down, new ScrollDownCommand(menu));

            keyboard.AddSystemCommand((int)Keys.W, new ScrollUpCommand(menu));
            keyboard.AddSystemCommand((int)Keys.S, new ScrollDownCommand(menu));

            keyboard.AddSystemCommand((int)Keys.Enter, new SelectCommand(menu));

            return(keyboard);
        }
コード例 #3
0
        public static KeyboardController SetupLevelKeyboard1P(PlayerChar mario, Scene scene)
        {
            KeyboardController keyboard = new KeyboardController();

            // Add system commands here
            keyboard.AddSystemCommand((int)Keys.Q, new QuitCommand(scene));
            keyboard.AddSystemCommand((int)Keys.Space, new ResetCommand(scene));
            keyboard.AddSystemCommand((int)Keys.P, new PauseCommand(scene));

            keyboard.AddPlayerCommand((int)Keys.W, new UpCommand(mario));
            keyboard.AddPlayerCommand((int)Keys.S, new DownCommand(mario));
            keyboard.AddPlayerCommand((int)Keys.A, new LeftCommand(mario));
            keyboard.AddPlayerCommand((int)Keys.D, new RightCommand(mario));


            keyboard.AddPlayerCommand((int)Keys.U, new MarioSuperCommand(mario));
            keyboard.AddPlayerCommand((int)Keys.I, new MarioFireCommand(mario));
            keyboard.AddPlayerCommand((int)Keys.O, new MarioDamageCommand(mario));
            keyboard.AddPlayerCommand((int)Keys.Y, new MarioResetCommand(mario));

            keyboard.AddPlayerCommand((int)Keys.F, new MarioFireBallCommand(mario));
            return(keyboard);
        }
コード例 #4
0
        public static KeyboardController SetupLevelKeyboard2P(PlayerChar mario, PlayerChar luigi, Scene scene)
        {
            KeyboardController keyboard = new KeyboardController();

            // Add system commands here
            keyboard.AddSystemCommand((int)Keys.Q, new QuitCommand(scene));
            keyboard.AddSystemCommand((int)Keys.Space, new ResetCommand(scene));
            keyboard.AddSystemCommand((int)Keys.P, new PauseCommand(scene));

            // Add player commands here
            keyboard.AddPlayerCommand((int)Keys.Up, new UpCommand(luigi));
            keyboard.AddPlayerCommand((int)Keys.Down, new DownCommand(luigi));
            keyboard.AddPlayerCommand((int)Keys.Left, new LeftCommand(luigi));
            keyboard.AddPlayerCommand((int)Keys.Right, new RightCommand(luigi));

            keyboard.AddPlayerCommand((int)Keys.W, new UpCommand(mario));
            keyboard.AddPlayerCommand((int)Keys.S, new DownCommand(mario));
            keyboard.AddPlayerCommand((int)Keys.A, new LeftCommand(mario));
            keyboard.AddPlayerCommand((int)Keys.D, new RightCommand(mario));

            keyboard.AddPlayerCommand((int)Keys.F, new MarioFireBallCommand(mario));
            keyboard.AddPlayerCommand((int)Keys.L, new MarioFireBallCommand(luigi));
            return(keyboard);
        }