public InstructionScreen()
        {
            int screenWidth = Program.game.screenWidth;
            int screenHeight = Program.game.screenHeight;
            screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);

            int buttonWidth = screenWidth / 7;
            int buttonHeight = screenHeight / 8;
            int X = 40;
            int Y1 = 40;
            int Y2 = screenHeight / 2 + 5 * buttonHeight / 2;
            menuButton = new Button(new Point(X, Y1), buttonWidth, buttonHeight, "Main Menu", "Buttons/mainMenuButton");
            systemsButton = new Button(new Point(screenWidth / 5 - buttonWidth / 2, Y2), buttonWidth, buttonHeight, "Systems Requirements", "Buttons/system");
            selectButton = new Button(new Point(2 * screenWidth / 5 - buttonWidth / 2, Y2), buttonWidth, buttonHeight, "Select Options", "Buttons/selectOptions");
            gameButton = new Button(new Point(3 * screenWidth / 5 - buttonWidth / 2, Y2), buttonWidth, buttonHeight, "Game Play", "Buttons/gamePlay");
            createButton = new Button(new Point(4 * screenWidth / 5 - buttonWidth / 2, Y2), buttonWidth, buttonHeight, "Creating Mazes", "Buttons/creatingMazes");

            buttons = new List<Button>();
            buttons.Add(menuButton);
            buttons.Add(systemsButton);
            buttons.Add(selectButton);
            buttons.Add(gameButton);
            buttons.Add(createButton);

            instrState = InstrState.SYSTEM;
        }
Example #2
0
        public ScoreScreen(int _time, int _hits)
        {
            time = _time;
            hits = _hits;
            score = calcScore();
            numStars = calcNumStars();

            int screenWidth = Program.game.screenWidth;
            int screenHeight = Program.game.screenHeight;

            window = new Rectangle(screenWidth / 8, screenHeight / 8, 3 * screenWidth / 4, 3 * screenHeight / 4);
            int buttonWidth = screenWidth / 8;
            int buttonHeight = screenHeight / 8;

            int menuY = window.Bottom - 3 * window.Height / 4 - buttonHeight / 2;
            int resumeY = window.Bottom - 2 * window.Height / 4 - buttonHeight / 2;
            int nextY = window.Bottom - window.Height / 4 - buttonHeight / 2;
            int x = window.Right - window.Width / 4 - buttonWidth / 2;

            menuButton = new Button(new Point(x, menuY), buttonWidth, buttonHeight, "Main Menu", "Buttons/mainMenuButton");
            restartButton = new Button(new Point(x, resumeY), buttonWidth, buttonHeight, "Replay", "Buttons/replay");
            if (Program.game.level != 5)
                levelButton = new Button(new Point(x, nextY), buttonWidth, buttonHeight, "Next Level", "Buttons/next");
            else
                levelButton = new Button(new Point(x, nextY), buttonWidth, buttonHeight, "Hard", "Buttons/hard");

            stars = new List<Sprite>();
            for (int i = 0; i < numStars; i++)
                stars.Add(new Sprite(new Point(i * 80 + window.Left + window.Width / 4 - 100, window.Bottom - window.Height / 5 - 20)));

            Program.game.gameStats.updateLevelStats(Program.game.level, time, hits, score, numStars);
        }
        public InstructionScreen()
        {
            int screenWidth = Program.game.screenWidth;
            int screenHeight = Program.game.screenHeight;
            screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);

            int buttonWidth = screenWidth / 7;
            int buttonHeight = screenHeight / 8;
            int X = 40;
            int Y = 40;
            menuButton = new Button(new Point(X, Y), buttonWidth, buttonHeight, "Main Menu", "Buttons/mainMenuButton");
        }
Example #4
0
        public bool buttonSelecting(Button bt)
        {
            if (!hovering && overlaps(bt))
            {
                startTime = DateTime.Now;
                hoverTime.start();
                hovering = true;
                hoverBt = bt;
            }
            if (hoverTime.time == 2 && overlaps(bt))
                return true;

            return false;
        }
        public CalibrationScreen()
        {
            time = new GameTime();
            int screenWidth = Program.game.screenWidth;
            int screenHeight = Program.game.screenHeight;
            window = new Rectangle(0, 0, screenWidth, screenHeight);

            int buttonWidth = 170;
            int buttonHeight = 92;
            int y = window.Bottom - window.Height / 2;
            int menuX = window.Left + window.Width / 2 - buttonWidth / 2;
            menuButton = new Button(new Point(menuX, y), buttonWidth, buttonHeight, "Main Menu", "Buttons/mainMenuButton");
            buttons = new List<Button>();
            buttons.Add(menuButton);
        }
        public LevelSelectionScreen(bool _singlePlayer)
        {
            singlePlayer = _singlePlayer;

            int screenWidth = Program.game.screenWidth;
            int screenHeight = Program.game.screenHeight;
            int levelButtonWidth = screenWidth / 8;
            int levelButtonHeight = screenHeight / 8;
            int menuButtonWidth = 170;
            int menuButtonHeight = 92;

            int levelButton1y = screenHeight / 2 - 10;
            int levelButton2y = 2 * screenHeight / 3 + 40;
            int level1x = screenWidth / 2 - 5 * levelButtonWidth / 2;
            int level2x = screenWidth / 2 - levelButtonWidth / 2;
            int level3x = screenWidth / 2 + 3 * levelButtonWidth / 2;

            int menuButtony = screenHeight / 5;
            int easyx = screenWidth / 8;
            int menuButtonx = screenWidth / 2 - menuButtonWidth / 2;
            int hardx = 3 * screenWidth / 4;

            menuButton = new Button(new Point(menuButtonx, menuButtony), menuButtonWidth, menuButtonHeight, "Main Menu", "Buttons/mainMenuButton");
            easyButton = new Button(new Point(easyx, menuButtony), menuButtonWidth, menuButtonHeight, "Easy", "Buttons/easy");
            hardButton = new Button(new Point(hardx, menuButtony), menuButtonWidth, menuButtonHeight, "Hard", "Buttons/hard");

            easyLevelButtons = new List<Button>();
            easyLevelButtons.Add(new Button(new Point(level1x, levelButton1y), levelButtonWidth, levelButtonHeight, "level one", "LevelThumbnails/level0"));
            easyLevelButtons.Add(new Button(new Point(level2x, levelButton1y), levelButtonWidth, levelButtonHeight, "level two", "LevelThumbnails/level1"));
            easyLevelButtons.Add(new Button(new Point(level3x, levelButton1y), levelButtonWidth, levelButtonHeight, "level three", "LevelThumbnails/level2"));
            easyLevelButtons.Add(new Button(new Point(level1x, levelButton2y), levelButtonWidth, levelButtonHeight, "level four", "LevelThumbnails/level3"));
            easyLevelButtons.Add(new Button(new Point(level2x, levelButton2y), levelButtonWidth, levelButtonHeight, "level five", "LevelThumbnails/level4"));
            easyLevelButtons.Add(new Button(new Point(level3x, levelButton2y), levelButtonWidth, levelButtonHeight, "level six", "LevelThumbnails/level5"));

            hardLevelButtons = new List<Button>();
            hardLevelButtons.Add(new Button(new Point(level1x, levelButton1y), levelButtonWidth, levelButtonHeight, "level one", "LevelThumbnails/level6"));
            hardLevelButtons.Add(new Button(new Point(level2x, levelButton1y), levelButtonWidth, levelButtonHeight, "level two", "LevelThumbnails/level7"));
            hardLevelButtons.Add(new Button(new Point(level3x, levelButton1y), levelButtonWidth, levelButtonHeight, "level three", "LevelThumbnails/level8"));
            hardLevelButtons.Add(new Button(new Point(level1x, levelButton2y), levelButtonWidth, levelButtonHeight, "level four", "LevelThumbnails/level9"));
            hardLevelButtons.Add(new Button(new Point(level2x, levelButton2y), levelButtonWidth, levelButtonHeight, "level five", "LevelThumbnails/level10"));
            hardLevelButtons.Add(new Button(new Point(level3x, levelButton2y), levelButtonWidth, levelButtonHeight, "level six", "LevelThumbnails/level11"));

            levelsState = LevelsState.COOPEASY;
        }
        public CalibrationScreen()
        {
            countdown = 5;
            timer = new Timer();

            int screenWidth = Program.game.screenWidth;
            int screenHeight = Program.game.screenHeight;
            window = new Rectangle(0, 0, screenWidth, screenHeight);

            int buttonWidth = 170;
            int buttonHeight = 92;
            int y = window.Bottom - window.Height / 2;
            int menuX = window.Left + window.Width / 2 - buttonWidth / 2;
            startButton = new Button(new Point(menuX, y), buttonWidth, buttonHeight, "save", "Buttons/save");
            y = window.Bottom - window.Height / 3;
            menuButton = new Button(new Point(menuX, y), buttonWidth, buttonHeight, "settings", "Buttons/settings");
            buttons = new List<Button>();
            buttons.Add(menuButton);
        }
Example #8
0
 public PauseScreen()
 {
     int screenWidth = Program.game.screenWidth;
     int screenHeight = Program.game.screenHeight;
     window = new Rectangle(screenWidth / 8, screenHeight / 8, 3 * screenWidth / 4, 3 * screenHeight / 4);
     int buttonWidth = 170;
     int buttonHeight = 92;
     int y = window.Bottom - window.Height / 2;
     int menuX = window.Left + window.Width / 2 - 5 * buttonWidth / 2;
     int resumeX = window.Left + window.Width / 2 - buttonWidth / 2;
     int restartX = window.Left + window.Width / 2 + 3 * buttonWidth / 2;
     resumeButton = new Button(new Point(resumeX, y), buttonWidth, buttonHeight, "Resume", "Buttons/resume");
     restartButton = new Button(new Point(restartX, y), buttonWidth, buttonHeight, "Restart Level", "Buttons/restartLevel");
     menuButton = new Button(new Point(menuX, y), buttonWidth, buttonHeight, "Main Menu", "Buttons/mainMenuButton");
     buttons = new List<Button>();
     buttons.Add(resumeButton);
     buttons.Add(restartButton);
     buttons.Add(menuButton);
 }
Example #9
0
        public Maze(int _level, bool _singlePlayer)
        {
            goalColor = Color.Red;
            wallColor = Color.Black;
            timer = new Timer();
            wallHits = 0;
            prevHit = new bool[2] { false, false };
            level = _level;
            singlePlayer = _singlePlayer;

            balls = new List<Ball>();
            walls = new List<Rectangle>();
            goal = new Rectangle();
            switches = new List<DoorSwitch>();

            string mazeFile = "Mazes/" + level + ".maze";
            readFile(mazeFile);

            pauseButton = new Button(new Point(Program.game.screenWidth - 170, 30), 136, 72, "Pause", "Buttons/pause");
        }
Example #10
0
        public MainMenu()
        {
            int screenWidth = Program.game.screenWidth;
            int screenHeight = Program.game.screenHeight;
            screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);

            int buttonWidth = screenWidth / 7;
            int buttonHeight = screenHeight / 8;

            int Y1 = screenRectangle.Bottom - screenRectangle.Height / 3 - 45;
            int Y2 = screenRectangle.Bottom - screenRectangle.Height / 6 - 30;
            int X1 = screenRectangle.Left + screenRectangle.Width / 7;
            int X2 = screenRectangle.Left + 3 * screenRectangle.Width / 7;
            int X3 = screenRectangle.Left + 5 * screenRectangle.Width / 7;

            singlePlayerButton = new Button
                (new Point(X1, Y1), buttonWidth, buttonHeight, "single player", "Buttons/singlePlayer");
            coopModeButton = new Button
                (new Point(X2, Y1), buttonWidth, buttonHeight, "co op mode", "Buttons/coopMode");
            createMazeButton = new Button
                (new Point(X3, Y1), buttonWidth, buttonHeight, "create maze", "Buttons/createMaze");
            instructionsButton = new Button
                (new Point(X1, Y2), buttonWidth, buttonHeight, "instructions", "Buttons/instructions");
            statisticsButton = new Button
                (new Point(X2, Y2), buttonWidth, buttonHeight, "statistics", "Buttons/statistics");
            settingsButton = new Button
                (new Point(X3, Y2), buttonWidth, buttonHeight, "settings", "Buttons/settings");
            exitButton = new Button
                (new Point(Program.game.screenWidth - 170, 30), 136, 72, "exit", "Buttons/exit");
            hiddenButton1 = new Button (new Point(34, 30), 136, 72, "", "");
            hiddenButton2 = new Button(new Point(34, 120), 136, 72, "", "");

            buttons = new List<Button>();
            buttons.Add(singlePlayerButton);
            buttons.Add(coopModeButton);
            buttons.Add(createMazeButton);
            buttons.Add(instructionsButton);
            buttons.Add(statisticsButton);
            buttons.Add(settingsButton);
            buttons.Add(exitButton);
        }
Example #11
0
        public SettingsScreen()
        {
            int screenWidth = Program.game.screenWidth;
            int screenHeight = Program.game.screenHeight;
            screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);

            int smallButtonWidth = 136;
            int smallButtonHeight = 72;
            int largeButtonWidth = 170;
            int largeButtonHeight = 92;

            menuButton = new Button(new Point(screenWidth / 8, 50), smallButtonWidth, smallButtonHeight, "Main Menu", "Buttons/mainMenuButton");
            plLHand = new Button(new Point(screenWidth / 2 + smallButtonWidth, 170), smallButtonWidth, smallButtonHeight, "player one left", "Buttons/left");
            plRHand = new Button(new Point(screenWidth / 2 + 3 * smallButtonWidth, 170), smallButtonWidth, smallButtonHeight, "player one right", "Buttons/right");
            p2LHand = new Button(new Point(screenWidth / 2 + smallButtonWidth, 275), smallButtonWidth, smallButtonHeight, "player two left", "Buttons/left");
            p2RHand = new Button(new Point(screenWidth / 2 + 3 * smallButtonWidth, 275), smallButtonWidth, smallButtonHeight, "player two right", "Buttons/right");
            roomQuiet = new Button(new Point(screenWidth / 2 - smallButtonWidth, 380), smallButtonWidth, smallButtonHeight, "room low", "Buttons/low");
            roomAver = new Button(new Point(screenWidth / 2 + smallButtonWidth, 380), smallButtonWidth, smallButtonHeight, "room medium", "Buttons/medium");
            roomLoud = new Button(new Point(screenWidth / 2 + 3 * smallButtonWidth, 380), smallButtonWidth, smallButtonHeight, "room high", "Buttons/high");
            soundsOn = new Button(new Point(screenWidth / 2 + smallButtonWidth, 485), smallButtonWidth, smallButtonHeight, "sounds on", "Buttons/on");
            soundsOff = new Button(new Point(screenWidth / 2 + 3 * smallButtonWidth, 485), smallButtonWidth, smallButtonHeight, "sounds off", "Buttons/off");
            setBackground = new Button(new Point(screenWidth / 2 + largeButtonWidth, screenHeight - largeButtonHeight - 40),
                largeButtonWidth, largeButtonHeight, "setBackground", "Buttons/setBackground");
            setGoalImage = new Button(new Point(screenWidth / 2 - 2 * largeButtonWidth, screenHeight - largeButtonHeight - 40),
                largeButtonWidth, largeButtonHeight, "setGoalImage", "Buttons/setGoalImage");

            buttons = new List<Button>();
            buttons.Add(menuButton);
            buttons.Add(plRHand);
            buttons.Add(plLHand);
            buttons.Add(p2RHand);
            buttons.Add(p2LHand);
            buttons.Add(roomQuiet);
            buttons.Add(roomAver);
            buttons.Add(roomLoud);
            buttons.Add(soundsOn);
            buttons.Add(soundsOff);
            //            buttons.Add(setBackground);
            //            buttons.Add(setGoalImage);
        }
Example #12
0
        public ScoreScreen(int _time, int _hits)
        {
            hits = _hits;
            time = _time;

            if (time == 0)
                time = 1;

            calcScore();
            calcNumStars();

            int screenWidth = Program.game.screenWidth;
            int screenHeight = Program.game.screenHeight;
            scalar = 0;
            rotation = 0;

            window = new Rectangle(screenWidth / 8, screenHeight / 8, 3 * screenWidth / 4, 3 * screenHeight / 4);
            int buttonWidth = screenWidth / 8;
            int buttonHeight = screenHeight / 8;

            int menuY = window.Bottom - 3 * window.Height / 4 - buttonHeight / 2;
            int resumeY = window.Bottom - 2 * window.Height / 4 - buttonHeight / 2;
            int nextY = window.Bottom - window.Height / 4 - buttonHeight / 2;
            int x = window.Right - window.Width / 4 - buttonWidth / 2;

            menuButton = new Button(new Point(x, menuY), buttonWidth, buttonHeight, "Main Menu", "Buttons/mainMenuButton");
            restartButton = new Button(new Point(x, resumeY), buttonWidth, buttonHeight, "Replay", "Buttons/replay");
            if (Program.game.level != 5)
                levelButton = new Button(new Point(x, nextY), buttonWidth, buttonHeight, "Next", "Buttons/next");
            else
                levelButton = new Button(new Point(x, nextY), buttonWidth, buttonHeight, "Hard", "Buttons/hard");

            if (!Program.game.hiddenMode)
            {
                if (!Program.game.customLevel)
                    Program.game.gameStats.updateLevelStats(time, hits, score, numStars);
                else
                    Program.game.customStats.updateLevelStats(time, hits, score, numStars);
            }
        }
Example #13
0
 public StatsScreen()
 {
     calcTotalGameTime();
     window = new Rectangle(screenWidth * 7 / 25 , screenHeight / 3, 8 * screenWidth / 15, 7 * screenHeight / 10);
     hTopRow = screenHeight / 5;
     hOtherRows = screenHeight / 15 * 2;
     buttonHeight = screenHeight / 8;
     buttonWidth = screenWidth / 7;
     int x1 = screenWidth / 6 - buttonWidth / 2;
     int x2 = 5 * screenWidth / 6 - buttonWidth / 2;
     int x3 = screenWidth / 2 - buttonWidth / 2 ;
     int x4 = screenWidth / 2 - 5 * buttonWidth / 2 + 50;
     int x5 = screenWidth / 2 + 3 * buttonWidth / 2 - 50;
     int y1 = screenHeight / 9 - buttonHeight / 2;
     int y2 = screenHeight / 2 - 5 * buttonHeight / 2 + 20;
     upper1 = new Button(new Point(x3, y2), buttonWidth, hOtherRows, "Total", "Buttons/statistics");
     upper2 = new Button(new Point(x4, y2), buttonWidth, hOtherRows, "Simple", "Buttons/easy");
     upper3 = new Button(new Point(x5, y2), buttonWidth, hOtherRows, "Hard", "Buttons/hard");
     lower1 = new Button(new Point(x2, y1), buttonWidth, hOtherRows, "Reset", "Buttons/reset");
     lower2 = new Button(new Point(x1, y1), buttonWidth, hOtherRows, "Main", "Buttons/mainMenuButton");
     int levelX = window.Right - window.Width / 3 - buttonWidth / 2;
     statsState = StatsState.TOTAL;
 }
Example #14
0
        public Maze()
        {
            curColorIndex = 0;
            colorArray = new Color[] { Color.Orange, Color.Lime, Color.Pink, Color.Crimson, Color.White, Color.Orchid, Color.SteelBlue, Color.Gray };
            goalColor = Color.Red;
            if (!Program.game.hiddenMode)
                wallColor = Color.Black;
            else
                wallColor = Color.Transparent;
            timer = new Timer();
            wallHits = 0;
            prevHit = new bool[2] { false, false };

            balls = new List<Ball>();
            walls = new List<Rectangle>();
            goal = new Rectangle();
            switches = new List<DoorSwitch>();

            pauseButton = new Button(new Point(Program.game.screenWidth - 170, 30), 136, 72, "Pause", "Buttons/pause");

            string mazeFile;
            if (!Program.game.customLevel)
            {
                if (singlePlayer = Program.game.singlePlayer)
                    mazeFile = "Mazes/" + (Program.game.level + 12) + ".maze";
                else
                    mazeFile = "Mazes/" + Program.game.level + ".maze";
                readFile(mazeFile);
            }
            else
            {
                mazeFile = "Mazes/custom" + Program.game.level + ".maze";
                readFile(mazeFile);
                singlePlayer = balls.Count == 1;
            }
        }
        public LevelSelectionScreen(bool _singlePlayer)
        {
            singlePlayer = _singlePlayer;

            int screenWidth = Program.game.screenWidth;
            int screenHeight = Program.game.screenHeight;
            int levelButtonWidth = screenWidth / 8;
            int levelButtonHeight = screenHeight / 8;
            int menuButtonWidth = 170;
            int menuButtonHeight = 92;

            List<int> levely = new List<int>();
            levely.Add(screenHeight / 2 - 10);
            levely.Add(2 * screenHeight / 3 + 40);
            List<int> levelx = new List<int>();
            levelx.Add(screenWidth / 2 - 5 * levelButtonWidth / 2);
            levelx.Add(screenWidth / 2 - levelButtonWidth / 2);
            levelx.Add(screenWidth / 2 + 3 * levelButtonWidth / 2);

            int menuButtony = screenHeight / 5;
            int easyx = screenWidth / 8;
            int menuButtonx = screenWidth / 2 - menuButtonWidth / 2;
            int hardx = 3 * screenWidth / 4;

            menuButton = new Button(new Point(menuButtonx, menuButtony), menuButtonWidth, menuButtonHeight, "Main Menu", "Buttons/mainMenuButton");
            easyButton = new Button(new Point(easyx, menuButtony), menuButtonWidth, menuButtonHeight, "Easy", "Buttons/easy");
            hardButton = new Button(new Point(hardx, menuButtony), menuButtonWidth, menuButtonHeight, "Hard", "Buttons/hard");

            easyLevelButtons = new List<Button>();
            hardLevelButtons = new List<Button>();
            easyLevelStars = new List<Sprite>();
            hardLevelStars = new List<Sprite>();

            if (singlePlayer)
            {
                for (int i = 0; i < 6; i++)
                {
                    if (Program.game.unlockOn && i > Program.game.gameStats.data.singleNextLevelToUnlock)
                    {
                        easyLevelButtons.Add(new Button(new Point(levelx[i % 3], levely[i / 3]), levelButtonWidth, levelButtonHeight, levelNames[i], "LevelThumbnails/lockColor"));
                        easyLevelButtons[i].selectable = false;
                    }
                    else
                    {
                        easyLevelButtons.Add(new Button(new Point(levelx[i % 3], levely[i / 3]), levelButtonWidth, levelButtonHeight, levelNames[i], "LevelThumbnails/level" + (i+12)));
                        for (int j = 0; j < Program.game.gameStats.data.levelData[i + 12].numStars; j++)
                            easyLevelStars.Add(new Sprite(new Point(j * 60 + levelx[i % 3] + levelButtonWidth / 2 - 80, levely[i / 3] + levelButtonHeight - 20)));
                    }
                    if (Program.game.unlockOn && i + 6 > Program.game.gameStats.data.singleNextLevelToUnlock)
                    {
                        hardLevelButtons.Add(new Button(new Point(levelx[i % 3], levely[i / 3]), levelButtonWidth, levelButtonHeight, levelNames[i], "LevelThumbnails/lockColor"));
                        hardLevelButtons[i].selectable = false;
                    }
                    else
                    {
                        hardLevelButtons.Add(new Button(new Point(levelx[i % 3], levely[i / 3]), levelButtonWidth, levelButtonHeight, levelNames[i], "LevelThumbnails/level" + (i + 18)));
                        for (int j = 0; j < Program.game.gameStats.data.levelData[i + 18].numStars; j++)
                            hardLevelStars.Add(new Sprite(new Point(j * 60 + levelx[i % 3] + levelButtonWidth / 2 - 80, levely[i / 3] + levelButtonHeight - 20)));
                    }
                }
            }
            else
            {
                for (int i = 0; i < 6; i++)
                {
                    if (Program.game.unlockOn && i > Program.game.gameStats.data.coopNextLevelToUnlock)
                    {
                        easyLevelButtons.Add(new Button(new Point(levelx[i % 3], levely[i / 3]), levelButtonWidth, levelButtonHeight, levelNames[i], "LevelThumbnails/lockColor"));
                        easyLevelButtons[i].selectable = false;
                    }
                    else
                    {
                        easyLevelButtons.Add(new Button(new Point(levelx[i % 3], levely[i / 3]), levelButtonWidth, levelButtonHeight, levelNames[i], "LevelThumbnails/level" + i));
                        for (int j = 0; j < Program.game.gameStats.data.levelData[i].numStars; j++)
                            easyLevelStars.Add(new Sprite(new Point(j * 60 + levelx[i % 3] + levelButtonWidth / 2 - 80, levely[i / 3] + levelButtonHeight - 20)));
                    }
                    if (Program.game.unlockOn && i + 6 > Program.game.gameStats.data.coopNextLevelToUnlock)
                    {
                        hardLevelButtons.Add(new Button(new Point(levelx[i % 3], levely[i / 3]), levelButtonWidth, levelButtonHeight, levelNames[i], "LevelThumbnails/lockColor"));
                        hardLevelButtons[i].selectable = false;
                    }
                    else
                    {
                        hardLevelButtons.Add(new Button(new Point(levelx[i % 3], levely[i / 3]), levelButtonWidth, levelButtonHeight, levelNames[i], "LevelThumbnails/level" + (i + 6)));
                        for (int j = 0; j < Program.game.gameStats.data.levelData[i + 6].numStars; j++)
                            hardLevelStars.Add(new Sprite(new Point(j * 60 + levelx[i % 3] + levelButtonWidth / 2 - 80, levely[i / 3] + levelButtonHeight - 20)));
                    }
                }
            }

            levelsState = LevelsState.EASY;
        }
        public CreateMazeSelection()
        {
            int screenWidth = Program.game.screenWidth;
            int screenHeight = Program.game.screenHeight;
            levelButtonWidth = screenWidth / 8;
            levelButtonHeight = screenHeight / 8;
            levely = new List<int>();
            levely.Add(screenHeight / 2 - 10);
            levely.Add(2 * screenHeight / 3 + 40);
            levelx = new List<int>();
            levelx.Add(screenWidth / 2 - 5 * levelButtonWidth / 2);
            levelx.Add(screenWidth / 2 - levelButtonWidth / 2);
            levelx.Add(screenWidth / 2 + 3 * levelButtonWidth / 2);

            singlePlayer = true;
            easy = true;
            play = true;
            conformation = false;
            page = 0;

            confWindow = new Rectangle(3 * screenWidth / 8, 3 * screenHeight / 8, screenWidth / 4, screenHeight / 4);

            smallButtonHeight = 72;
            smallButtonWidth = 136;
            largeButtonWidth = 170;
            largeButtonHeight = 92;
            int row2 = screenHeight / 2 - 3 * smallButtonHeight;
            int row3 = screenHeight / 2 - 3 * smallButtonHeight / 2 - 10;

            createMazeButton = new Button(new Point(5 * screenWidth / 6 - largeButtonWidth / 2, screenHeight / 9 - largeButtonHeight / 2),
                largeButtonWidth, largeButtonHeight, "create maze", "Buttons/createMaze");
            singleButton = new Button(new Point(screenWidth / 3 - 2 * smallButtonWidth, row2), smallButtonWidth, smallButtonHeight, "Single Player", "Buttons/singlePlayer");
            coOpButton = new Button(new Point(screenWidth / 3 - smallButtonWidth / 2, row2), smallButtonWidth, smallButtonHeight, "Co Op Mode", "Buttons/coopMode");
            easyButton = new Button(new Point(2 * screenWidth / 3 - smallButtonWidth / 2, row2),
                smallButtonWidth, smallButtonHeight, "easy", "Buttons/easy");
            hardButton = new Button(new Point(2 * screenWidth / 3 + smallButtonWidth, row2),
                smallButtonWidth, smallButtonHeight, "hard", "Buttons/hard");
            playButton = new Button(new Point(screenWidth / 2 - 3 * smallButtonWidth / 2, row3), smallButtonWidth, smallButtonHeight, "Play", "Buttons/play");
            deleteButton = new Button(new Point(screenWidth / 2 + smallButtonWidth / 2, row3), smallButtonWidth, smallButtonHeight, "Delete", "Buttons/delete");
            menuButton = new Button(new Point(screenWidth / 6 - largeButtonWidth / 2, screenHeight / 9 - largeButtonHeight / 2),
                largeButtonWidth, largeButtonHeight, "Main Menu", "Buttons/mainMenuButton");
            nextButton = new Button(new Point(10 * screenWidth / 11 - smallButtonWidth / 2, 10 * screenHeight / 11 - smallButtonHeight / 2),
                smallButtonWidth, smallButtonHeight, "Next", "Buttons/next");
            prevButton = new Button(new Point(screenWidth / 11 - smallButtonWidth / 2, 10 * screenHeight / 11 - smallButtonHeight / 2),
                smallButtonWidth, smallButtonHeight, "Previous", "Buttons/previous");
            yesButton = new Button(new Point(confWindow.Left + confWindow.Width / 4 - 40, confWindow.Bottom - confWindow.Height / 3 - 25), 80, 50, "Yes", "Buttons/yes");
            noButton = new Button(new Point(confWindow.Right - confWindow.Width / 4 - 40, confWindow.Bottom - confWindow.Height / 3 - 25), 80, 50, "No", "Buttons/no");

            levelButtons = new List<Button>();
            stars = new List<List<Sprite>>();
            for (int i = 0; i < Program.game.customStats.data.customLevelIDs.Count; i++)
            {
                int nameId = Program.game.customStats.data.customLevelIDs[i];
                string imageName = "custom" + nameId + ".png";
                if (File.Exists(imageName))
                    levelButtons.Add(new Button(new Point(levelx[i % 3], levely[(i / 3) % 2]), levelButtonWidth, levelButtonHeight, "Level " + nameId, imageName, true));
                stars.Add(new List<Sprite>());
                for (int j = 0; j < Program.game.customStats.data.customData[nameId].numStars; j++)
                    stars[stars.Count - 1].Add(new Sprite(new Point(j * 60 + levelx[i % 3] + levelButtonWidth / 2 - 80, levely[(i / 3) % 2] + levelButtonHeight - 20)));
            }

            Program.game.customStats.data.numCustomLevels = levelButtons.Count;

            buttons = new List<Button>();
            buttons.Add(createMazeButton);
            buttons.Add(singleButton);
            buttons.Add(coOpButton);
            buttons.Add(easyButton);
            buttons.Add(hardButton);
            buttons.Add(playButton);
            buttons.Add(deleteButton);
            buttons.Add(menuButton);
        }
Example #17
0
        public StatsScreen()
        {
            conformation = false;
            custPage = 0;

            calcTotalGameTime();
            window = new Rectangle(screenWidth * 7 / 25 , screenHeight / 3 + 50, 8 * screenWidth / 15, 7 * screenHeight / 10);
            confWindow = new Rectangle(3 * screenWidth / 8, 3 * screenHeight / 8, screenWidth / 4, screenHeight / 4);
            hTopRow = screenHeight / 5;
            hOtherRows = screenHeight / 15 * 2;
            smallButtonHeight = 72;
            smallButtonWidth = 136;
            largeButtonWidth = 170;
            largeButtonHeight = 92;

            int row1 = screenHeight / 9 - largeButtonHeight / 2;
            int row2 = screenHeight / 2 - 3 * smallButtonHeight;
            int row3 = screenHeight / 2 - 3 * smallButtonHeight / 2 - 10;

            resetButton = new Button(new Point(5 * screenWidth / 6 - smallButtonWidth / 2, row1), largeButtonWidth,
                largeButtonHeight, "Reset", "Buttons/reset");
            mainMenuButton = new Button(new Point(screenWidth / 6 - smallButtonWidth / 2, row1), largeButtonWidth,
                largeButtonHeight, "Main", "Buttons/mainMenuButton");
            totalButton = new Button(new Point(screenWidth / 2 - smallButtonWidth * 3, row2), smallButtonWidth,
                smallButtonHeight, "Total", "Buttons/totalButton");
            singlePlayerButton = new Button(new Point(screenWidth / 2 - (int)(smallButtonWidth * 3/2) + 20, row2), smallButtonWidth,
                smallButtonHeight, "Total", "Buttons/singlePlayer");
            coopModeButton = new Button(new Point(screenWidth / 2 + (int)(smallButtonWidth / 2) - 20, row2), smallButtonWidth,
                smallButtonHeight, "Total", "Buttons/coopMode");
            createdMazesButton = new Button(new Point(screenWidth / 2 + smallButtonWidth * 2, row2), smallButtonWidth,
                smallButtonHeight, "Total", "Buttons/createdMazes");
            easyButton = new Button(new Point(screenWidth / 2 - 2 * smallButtonWidth, row3), smallButtonWidth,
                smallButtonHeight, "Easy", "Buttons/easy");
            hardButton = new Button(new Point(screenWidth / 2 + smallButtonWidth, row3), smallButtonWidth,
                smallButtonHeight, "Hard", "Buttons/hard");
            nextButton = new Button(new Point(10 * screenWidth / 11 - smallButtonWidth / 2, 10 * screenHeight / 11 - smallButtonHeight / 2),
                smallButtonWidth, smallButtonHeight, "Next", "Buttons/next");
            prevButton = new Button(new Point(screenWidth / 11 - smallButtonWidth / 2, 10 * screenHeight / 11 - smallButtonHeight / 2),
                smallButtonWidth, smallButtonHeight, "Previous", "Buttons/previous");
            yesButton = new Button(new Point(confWindow.Left + confWindow.Width / 4 - 40, confWindow.Bottom - confWindow.Height / 3 - 25), 80, 50, "Yes", "Buttons/yes");
            noButton = new Button(new Point(confWindow.Right - confWindow.Width / 4 - 40, confWindow.Bottom - confWindow.Height / 3 - 25), 80, 50, "No", "Buttons/no");
            int levelX = window.Right - window.Width / 3 - smallButtonWidth / 2;
            statsState = StatsState.TOTAL;

            stars = new List<List<Sprite>>();
            stars.Add(new List<Sprite>());
            stars.Add(new List<Sprite>());
            stars.Add(new List<Sprite>());
            stars.Add(new List<Sprite>());
            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < Program.game.gameStats.data.levelData[i + 12].numStars; j++)
                    stars[0].Add(new Sprite(new Point(screenWidth / 5 + 750 + 50 * j, screenHeight / 3 + 173 + 50 * i)));
                for (int j = 0; j < Program.game.gameStats.data.levelData[i + 18].numStars; j++)
                    stars[1].Add(new Sprite(new Point(screenWidth / 5 + 750 + 50 * j, screenHeight / 3 + 173 + 50 * i)));
                for (int j = 0; j < Program.game.gameStats.data.levelData[i].numStars; j++)
                    stars[2].Add(new Sprite(new Point(screenWidth / 5 + 750 + 50 * j, screenHeight / 3 + 173 + 50 * i)));
                for (int j = 0; j < Program.game.gameStats.data.levelData[i + 6].numStars; j++)
                    stars[3].Add(new Sprite(new Point(screenWidth / 5 + 750 + 50 * j, screenHeight / 3 + 173 + 50 * i)));
            }
            for (int i = 0; i < Program.game.customStats.data.customLevelIDs.Count; i++)
            {
                if (i % 6 == 0)
                    stars.Add(new List<Sprite>());
                int nameId = Program.game.customStats.data.customLevelIDs[i];
                for (int j = 0; j < Program.game.customStats.data.customData[nameId].numStars; j++)
                    stars[stars.Count - 1].Add(new Sprite(new Point(screenWidth / 5 + 750 + 50 * j, screenHeight / 3 + 113 + 50 * (i % 6))));
            }

            buttons = new List<Button>();
            buttons.Add(totalButton);
            buttons.Add(easyButton);
            buttons.Add(hardButton);
            buttons.Add(resetButton);
            buttons.Add(mainMenuButton);
            buttons.Add(singlePlayerButton);
            buttons.Add(coopModeButton);
            buttons.Add(createdMazesButton);
            buttons.Add(nextButton);
            buttons.Add(prevButton);
        }
Example #18
0
        public CreateMaze(bool hard, bool _singleplayer)
        {
            singleplayer = _singleplayer;
            hl = goalSet = p1set = p2set = done = false;

            state = CreateState.WALLS;

            failWindow = new Rectangle(3 * Program.game.screenWidth / 8, 3 * Program.game.screenHeight / 8,
                Program.game.screenWidth / 4, Program.game.screenHeight / 4);

            wallButton = new Button(new Point(30, 30), 136, 72, "Wall", "Buttons/wall");
            goalButton = new Button(new Point(200, 30), 136, 72, "Goal", "Buttons/goal");
            p1Button = new Button(new Point(370, 30), 136, 72, "Player One", "Buttons/playerOne");
            p2Button = new Button(new Point(540, 30), 136, 72, "Player Two", "Buttons/playerTwo");
            backButton = new Button(new Point(Program.game.screenWidth - 166, 30), 136, 72, "Back", "Buttons/back");
            saveButton = new Button(new Point(Program.game.screenWidth - 332, 30), 136, 72, "Save", "Buttons/save");
            okButton = new Button(new Point(Program.game.screenWidth / 2 - 40, failWindow.Bottom - failWindow.Height / 3 - 25), 80, 50, "okay", "Buttons/ok");

            buttons = new List<Button>();
            buttons.Add(wallButton);
            buttons.Add(goalButton);
            buttons.Add(p1Button);
            buttons.Add(p2Button);
            buttons.Add(backButton);
            buttons.Add(saveButton);

            hlColor = new Color(25, 255, 55, 25);
            tempColor = new Color(0, 0, 0, 25);
            wallColor = Color.Black;
            goalColor = Color.Red;

            border = new List<Rectangle>();
            walls = new List<Rectangle>();
            twalls = new List<Rectangle>();
            tgoals = new List<Rectangle>();
            tplayers = new List<Rectangle>();
            p1 = new Ball(new Point(0, 0), Color.Blue);
            p2 = new Ball(new Point(0, 0), Color.Yellow);

            border.Add(new Rectangle(Program.game.sx(0), Program.game.sy(0), 10, 490));
            border.Add(new Rectangle(Program.game.sx(960), Program.game.sy(0), 10, 490));
            border.Add(new Rectangle(Program.game.sx(0), Program.game.sy(0), 970, 10));
            border.Add(new Rectangle(Program.game.sx(0), Program.game.sy(480), 970, 10));

            int cols = 6, rows = 3, size = 160;
            if (hard)
            {
                cols *= 2;
                rows *= 2;
                size /= 2;
            }

            for (int i = 0; i < cols; i++)
            {
                for (int j = 0; j < rows; j++)
                {
                    if (j > 0)
                        twalls.Add(new Rectangle(Program.game.sx(i * size), Program.game.sy(j * size), size + 10, 10));
                    if (i > 0)
                        twalls.Add(new Rectangle(Program.game.sx(i * size), Program.game.sy(j * size), 10, size + 10));
                    tgoals.Add(new Rectangle(Program.game.sx(10 + i * size), Program.game.sy(10 + j * size), size - 10, size - 10));
                    tplayers.Add(new Rectangle(Program.game.sx(i * size + size / 2 - 15), Program.game.sy(j * size + size / 2 - 15), 40, 40));
                }
            }
        }