Beispiel #1
0
        /// <summary>
        /// press space to start or pause, Escape to switch in game over mode
        /// </summary>
        /// <param name="key"></param>
        public void KeyPressed(PacmanKey key)
        {
            // Gestion des flèches pour le déplacement du pacman

            if (key == PacmanKey.Pause)
            {
                // touche Pause ou P
                Paused = !Paused;
            }
            else if (key == PacmanKey.Space && ((GameMode.GAME_OVER_DEATH == Status) || (GameMode.GAME_OVER_ESC == Status)))
            {
                SetMode(GameMode.READY);
            }
            else if (key == PacmanKey.Escape)
            {
                SetMode(GameMode.GAME_OVER_ESC);
            }
            else if (key == PacmanKey.NextLevel)
            {
                Labyrinth.getCurrent().RemainingPills = 0;
            }
            else
            if (_Pacman != null)
            {
                _cfg.play.Add(new GameRecord(oturn + 1, key));
            }
        }
Beispiel #2
0
        /// <summary>
        /// press space to start or pause, Escape to switch in game over mode
        /// </summary>
        /// <param name="key"></param>
        public void KeyPressed(PacmanKey key)
        {
            // Gestion des flèches pour le déplacement du pacman

            if (key == PacmanKey.Pause)
            {
                // touche Pause ou P
                Paused = !Paused;
            }

            if (_Pacman != null)
            {
                switch (key)
                {
                case PacmanKey.Left:
                    _Pacman.Left();
                    break;

                case PacmanKey.Right:
                    _Pacman.Right();
                    break;

                case PacmanKey.Down:
                    _Pacman.Down();
                    break;

                case PacmanKey.Up:
                    _Pacman.Up();
                    break;
                }
            }

            if (key == PacmanKey.Space && GameMode.GAME_OVER == Status)
            {
                // passe en mode de jeu READY
                numLaby = 0;
                Level   = 1;
                SetLabyrinth(numLaby);
                // initialisation du score, des vies, ...
                Lives     = 3;
                LifeScore = 5000;
                Score     = 0;
                SetMode(GameMode.READY);
                if (Audio != null)
                {
                    Audio.PlayIntro();
                }
            }
            else if (key == PacmanKey.Escape)
            {
                SetMode(GameMode.GAME_OVER);
            }
            else if (key == PacmanKey.NextLevel)
            {
                Labyrinth.getCurrent().RemainingPills = 0;
            }
        }
Beispiel #3
0
 public GameRecord(int _tim, PacmanKey _key)
 {
     tim   = _tim;
     key   = _key;
     isKey = true;
 }
Beispiel #4
0
 void pacmanSpetialKey(PacmanKey key)
 {
     _gamepresenter.CurrentGame.lastKeyTurn = 0;;
     CurrentGame.KeyPressed(key);
 }