Example #1
0
        //creates a new gameplay screen
        public GameplayScreen(string player1Name, string player2Name, string nameOfTheMap, 
            bool player1IsAI, bool player2IsAI, int player1AILevel, int player2AILevel)
        {
            //times for the transition
            TransitionOnTime = TimeSpan.FromSeconds(0.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            //sets the escape-key as the pause button and enter as the restart game button
            pauseAction = new InputAction(new Keys[] { Keys.Escape }, true);
            endGameAction = new InputAction(new Keys[] { Keys.Enter }, true);

            screenWidth = 1024;
            screenHeight = 768;

            p1name = player1Name;
            p2name = player2Name;
            mapName = nameOfTheMap;
            p1ai = player1IsAI;
            p2ai = player2IsAI;
            p1aiLevel = player1AILevel;
            p2aiLevel = player2AILevel;

            clock = new Timer(20.0f);
            //fps = new FPS(screenWidth);
            map = new Map(mapName);
            pills = new Pills(map, 100, screenWidth, screenHeight, 32);
            player1 = new Player(0, 0, screenWidth, screenHeight, p1name, map, p1ai, p1aiLevel, pills);
            player2 = new Player(screenWidth - 32, screenHeight - 32, screenWidth, screenHeight, p2name, map, p2ai, p2aiLevel, pills);
            scores = new Scores(screenWidth);
            controls = new PlayerControls();
            gameEnds = false;
        }
Example #2
0
        public MenuScreen(string menuTitle)
        {
            this.menuTitle = menuTitle;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            menuUp = new InputAction(
                new Keys[] { Keys.Up },
                true);
            menuDown = new InputAction(
                new Keys[] { Keys.Down },
                true);
            menuSelect = new InputAction(
                new Keys[] { Keys.Enter, Keys.Space },
                true);
            menuCancel = new InputAction(
                new Keys[] { Keys.Escape },
                true);
        }
        public MessageBoxScreen(string message, bool includeUsageText)
        {
            const string usageText = "\nEnter = Yes, rehab here I come.." +
                                     "\nEsc = No, rehab is for quitters!";

            if (includeUsageText)
                this.message = message + usageText;
            else
                this.message = message;

            IsPopup = true;

            TransitionOnTime = TimeSpan.FromSeconds(0.2);
            TransitionOffTime = TimeSpan.FromSeconds(0.2);

            menuSelect = new InputAction(
                new Keys[] { Keys.Enter },
                true);
            menuCancel = new InputAction(
                new Keys[] { Keys.Escape },
                true);
        }