예제 #1
0
        public override void Initialize()
        {
            SpriteFont comicSans20 = ContentManager.LoadSpriteFont("SpriteFonts/ComicSans20");
            SpriteFont comicSans30 = ContentManager.LoadSpriteFont("SpriteFonts/ComicSans30");

            loseMessage  = new SpriteFontGraphic("You lose!", comicSans30, new Vector2(350, 270), Color.White);
            instructions = new SpriteFontGraphic("Press Space to try again or Escape to go back to the main menu", comicSans20, new Vector2(120, 300), Color.White);
            keyLocker.LockKey(Keys.Space);
            keyLocker.LockKey(Keys.Escape);
        }
예제 #2
0
        public override void Initialize()
        {
            // setup graphics on screen (background map, spritefont text)
            background = new TitleScreenMap();
            background.SetAdjustCamera(false);

            keyLocker.LockKey(Keys.Space);
        }
예제 #3
0
 public override void Initialize()
 {
     background = new TitleScreenMap();
     background.SetAdjustCamera(false);
     background.SetCameraLocation(Direction.LEFT, Direction.DOWN);
     keyTimer.SetWaitTime(200);
     menuItemSelected = -1;
     keyLocker.LockKey(Keys.Space);
 }
예제 #4
0
        // player STANDING state logic
        protected void PlayerStanding(KeyboardState keyboardState)
        {
            // sets animation to a STAND animation based on which way player is facing
            currentAnimationName = FacingDirection == Direction.RIGHT ? "STAND_RIGHT" : "STAND_LEFT";

            // if walk left or walk right key is pressed, player enters WALKING state
            if (keyboardState.IsKeyDown(MOVE_LEFT_KEY) || keyboardState.IsKeyDown(MOVE_RIGHT_KEY))
            {
                PlayerState = PlayerState.WALKING;
            }

            // if jump key is pressed, player enters JUMPING state
            else if (keyboardState.IsKeyDown(JUMP_KEY) && !keyLocker.IsKeyLocked(JUMP_KEY))
            {
                keyLocker.LockKey(JUMP_KEY);
                PlayerState = PlayerState.JUMPING;
            }

            // if crouch key is pressed, player enters CROUCHING state
            else if (keyboardState.IsKeyDown(CROUCH_KEY))
            {
                PlayerState = PlayerState.CROUCHING;
            }
        }
예제 #5
0
        protected void HandleLeftKeyPressed(KeyboardState keyboardState)
        {
            // if shift key is also held, highlight
            if (IsShiftKeyPressed())
            {
                if (CursorPosition > 0)
                {
                    CursorPosition--;
                    highlightMode = true;
                }
                if (CursorPosition < highlightCursorIndex)
                {
                    HighlightStartIndex = CursorPosition;
                }
                else if (CursorPosition > highlightCursorIndex)
                {
                    HighlightEndIndex = CursorPosition;
                }
                else
                {
                    HighlightStartIndex = CursorPosition;
                    HighlightEndIndex   = CursorPosition;
                }
                if (!IsTextHighlighted)
                {
                    cursorChangeTimer.SetWaitTime(100);
                    showCursor = true;
                }

                keyLocker.LockKey(Keys.Left);
                keyLocker.UnlockKey(Keys.Right);
                cursorChangeTimer.SetWaitTime(100);
            }
            // move cursor to left
            else
            {
                if (!IsTextHighlighted)
                {
                    CursorPosition--;
                }
                else
                {
                    CursorPosition = HighlightStartIndex;
                }
                ResetCursorBlinkTimer();

                keyLocker.LockKey(Keys.Left);
                keyLocker.UnlockKey(Keys.Right);
                cursorChangeTimer.SetWaitTime(100);

                ResetHighlightIndexes();
                highlightMode = false;
            }
        }