示例#1
0
        public override void setPressedButton(Keys code)
        {
            switch (code)
            {
            case Keys.Down:
                megaMan.dick();
                break;

            case Keys.Right:
                megaMan.setDirection(ParticularObject.MainDir.RIGHT_DIR);
                megaMan.run();
                break;

            case Keys.Left:
                megaMan.setDirection(ParticularObject.MainDir.LEFT_DIR);
                megaMan.run();
                break;

            case Keys.Enter:
                if (state == GameState.INIT_GAME)
                {
                    if (previousState == GameState.GAMEPLAY)
                    {
                        switchState(GameState.GAMEPLAY);
                    }
                    else
                    {
                        switchState(GameState.TUTORIAL);
                    }

                    //bgMusic.loop();
                    //bgMusic.play();
                }
                if (state == GameState.TUTORIAL && storyTutorial >= 1)
                {
                    if (storyTutorial <= 3)
                    {
                        storyTutorial++;
                        currentSize  = 1;
                        textTutorial = texts1[storyTutorial - 1];
                    }
                    else
                    {
                        switchState(GameState.GAMEPLAY);
                    }

                    // for meeting boss tutorial
                    if (tutorialState == TutorialState.MEETreadonlyBOSS)
                    {
                        switchState(GameState.GAMEPLAY);
                    }
                }
                break;

            case Keys.Space:
                megaMan.jump();
                break;

            case Keys.A:
                megaMan.attack(gameTime);
                break;
            }
        }