Example #1
0
        static void PlayerMovement()
        {
            switch (pacman.CheckCell(border, pacman.NextDirection, ghostList))
            {
            case BoardElements.Dot:
                MovePlayer(pacman.NextDirection);
                pacman.EarnPoint();
                pacman.Direction = pacman.NextDirection;
                LoadGUI();
                break;

            case BoardElements.Star:
                MovePlayer(pacman.NextDirection);
                pacman.EarnStar();
                pacman.Direction = pacman.NextDirection;
                LoadGUI();
                break;

            case BoardElements.Empty:
                MovePlayer(pacman.NextDirection);
                pacman.Direction = pacman.NextDirection;
                break;

            case BoardElements.Ghost:
                pacman.LoseLife();
                MovePlayer("reset");
                LoadGUI();
                break;

            case BoardElements.Wall:
                switch (pacman.CheckCell(border, pacman.Direction, ghostList))
                {
                case BoardElements.Dot:
                    MovePlayer(pacman.Direction);
                    pacman.EarnPoint();
                    LoadGUI();
                    break;

                case BoardElements.Star:
                    MovePlayer(pacman.Direction);
                    pacman.EarnStar();
                    LoadGUI();
                    break;

                case BoardElements.Empty:
                    MovePlayer(pacman.Direction);
                    break;

                case BoardElements.Ghost:
                    pacman.LoseLife();
                    MovePlayer("reset");
                    LoadGUI();
                    break;

                case BoardElements.Wall:
                    break;
                }
                break;
            }
        }