Пример #1
0
        public HowToPlay(ContentManager content, EventHandler screenEvent, Game1 game1)
            : base(screenEvent)
        {
            this.game = game1;

            background          = content.Load<Texture2D>("Images/Menu/Background/background");
            backButtonTexture   = content.Load<Texture2D>(@"Images/Menu/backbutton");
            menuBox             = content.Load<Texture2D>("Images/Menu/Background/howtoplaybox2");

            paddle      = content.Load<Texture2D>("Images/Game/paddle5");
            ball        = content.Load<Texture2D>("Images/Game/ball5");
            brick       = content.Load<Texture2D>("Images/Game/brick3");
            points      = content.Load<Texture2D>("Images/Game/Powerups/points2");
            life        = content.Load<Texture2D>("Images/Game/Powerups/life2");
            paddleUp    = content.Load<Texture2D>("Images/Game/Powerups/paddleup3");
            paddleDown  = content.Load<Texture2D>("Images/Game/Powerups/paddledown2");
            multiBall   = content.Load<Texture2D>("Images/Game/Powerups/multiball2");
            paddleShoot = content.Load<Texture2D>("Images/Game/Powerups/paddleshoot2");

            font    = content.Load<SpriteFont>("Font/SpriteFont1");
            font2   = content.Load<SpriteFont>("Font/SpriteFont2");
            font3   = content.Load<SpriteFont>("Font/SpriteFont3");

            backButtonRectangle = new Rectangle((game1.Window.ClientBounds.Width - menuButtonWidth) / 2, 600, menuButtonWidth, menuButtonHeight);

            backButton = new Button(backButtonTexture, backButtonRectangle);
        }
Пример #2
0
        public GameComplete(ContentManager content, EventHandler screenEvent, Game1 game1)
            : base(screenEvent)
        {
            this.game = game1;

            gameCompleteBackground  = content.Load<Texture2D>("Images/Menu/Background/gamecompletebackground");
            mainMenuButtonTexture   = content.Load<Texture2D>(@"Images/Menu/mainmenubutton");

            font3 = content.Load<SpriteFont>("Font/SpriteFont3");

            mainMenuButtonRectangle = new Rectangle((game1.Window.ClientBounds.Width - menuButtonWidth) / 2, 600, menuButtonWidth, menuButtonHeight);

            mainMenuButton = new Button(mainMenuButtonTexture, mainMenuButtonRectangle);
        }
Пример #3
0
        public Play(ContentManager content, EventHandler screenEvent, Game1 game1, Rectangle gameField, int difficulty)
            : base(screenEvent)
        {
            game = game1;

            this.difficulty = difficulty;

            if (difficulty == 0)
            {
                difficultyString = "Casual";
                difficultyPaddleMod = 10;
            }
            else if (difficulty == 1)
            {
                difficultyString = "Normal";
                difficultyPaddleMod = 0;
            }
            else
            {
                difficultyString = "Hard";
                difficultyPaddleMod = -10;
            }

            this.gameField = gameField;

            //Grafik
            gameBackground      = content.Load<Texture2D>("Images/Menu/Background/playbackground5");
            pausedBackground    = content.Load<Texture2D>("Images/Menu/Background/pausbackground");
            gameHud             = content.Load<Texture2D>("Images/Menu/Background/hudbackground2");
            menuBox             = content.Load<Texture2D>("Images/Menu/Background/box4");
            paddleTexture       = content.Load<Texture2D>("Images/Game/paddle5");
            ballTexture         = content.Load<Texture2D>("Images/Game/ball5");
            brickTexture        = content.Load<Texture2D>("Images/Game/brick3");
            extraLifeTexture    = content.Load<Texture2D>("Images/Game/Powerups/life2");
            paddleUpTexture     = content.Load<Texture2D>("Images/Game/Powerups/paddleup3");
            paddleDownTexture   = content.Load<Texture2D>("Images/Game/Powerups/paddledown2");
            extraPointsTexture  = content.Load<Texture2D>("Images/Game/Powerups/points2");
            multiBallTexture    = content.Load<Texture2D>("Images/Game/Powerups/multiball2");
            paddleShootTexture  = content.Load<Texture2D>("Images/Game/Powerups/paddleshoot2");
            laserTexture        = content.Load<Texture2D>("Images/Game/Powerups/laser3");

            pausButtonTexture[continueGameIndex]    = content.Load<Texture2D>(@"Images/Menu/continuebutton");
            pausButtonTexture[resetGameIndex]       = content.Load<Texture2D>(@"Images/Menu/restartbutton");
            pausButtonTexture[mainMenuIndex]        = content.Load<Texture2D>(@"Images/Menu/mainmenubutton");
            pausButtonTexture[quitGameIndex]        = content.Load<Texture2D>(@"Images/Menu/quitbutton");
            nextLevelTexture                        = content.Load<Texture2D>(@"Images/Menu/nextlevelbutton");

            font    = content.Load<SpriteFont>("Font/SpriteFont1");
            font2   = content.Load<SpriteFont>("Font/SpriteFont2");
            font4   = content.Load<SpriteFont>("Font/SpriteFont4");

            //Ny boll och platta
            balls.Add(new Ball(ballTexture, gameField));
            paddle = new Paddle(paddleTexture,
                                gameField,
                                Life(difficulty),
                                new Rectangle((gameField.Width - paddleTexture.Width) / 2,
                                               gameField.Height - paddleTexture.Height - 30,
                                               paddleTexture.Width + difficultyPaddleMod,
                                               paddleTexture.Height));
            //Knappar och pausmenyn
            MenuButtonsPrep();

            for (int i = 0; i < nPausButtons; i++)
            {
                pausButtons.Add(new Button(pausButtonTexture[i], pausButtonRectangle[i]));
            }

            nextLevelButton = new Button(nextLevelTexture, nextLevelRectangle = new Rectangle(440, 410, menuButtonWidth, menuButtonHeight));

            defaultMainMenuLocation = pausButtons[mainMenuIndex].Rectangle;
            defaultResetGameLocation = pausButtons[resetGameIndex].Rectangle;

            newMainMenuLocation = new Rectangle(660, 410, menuButtonWidth, menuButtonHeight);
            newResetGameLocation = new Rectangle(440, 410, menuButtonWidth, menuButtonHeight);

            for (int i = 0; i < totalLevels; i++)
            {
                levelSelect.Add(Keys.D1 + (i));
            }

            NewGame();
        }
Пример #4
0
        public Options(ContentManager content, EventHandler screenEvent, Game1 game1, GraphicsDeviceManager graphics)
            : base(screenEvent)
        {
            this.graphics = graphics;
            this.game = game1;

            background          = content.Load<Texture2D>("Images/Menu/Background/background");
            backButtonTexture   = content.Load<Texture2D>(@"Images/Menu/backbutton");
            menuBox             = content.Load<Texture2D>("Images/Menu/Background/box4");
            checkboxTextureOn   = content.Load<Texture2D>(@"Images/Menu/checkboxon5");
            checkboxTextureOff  = content.Load<Texture2D>(@"Images/Menu/checkbox");

            musicVolumeTexture              = content.Load<Texture2D>("Images/Game/paddle2");
            musicVolumeBackgroundTexture    = content.Load<Texture2D>(@"Images/Menu/checkbox");
            soundEVolumeTexture             = content.Load<Texture2D>("Images/Game/paddle2");
            soundEVolumeBackgroundTexture   = content.Load<Texture2D>(@"Images/Menu/checkbox");

            font    = content.Load<SpriteFont>("Font/SpriteFont1");
            font2   = content.Load<SpriteFont>("Font/SpriteFont2");
            font3   = content.Load<SpriteFont>("Font/SpriteFont3");

            backButtonRectangle         = new Rectangle((game1.Window.ClientBounds.Width - menuButtonWidth) / 2, 600, menuButtonWidth, menuButtonHeight);
            fullscreenRectangle         = new Rectangle((game.Window.ClientBounds.Width) / 2 + 335, 230, checkboxWidth, checkboxHeight);
            vsyncRectangle              = new Rectangle((game.Window.ClientBounds.Width) / 2 + 335, 280, checkboxWidth, checkboxHeight);
            muteMusicRectangle          = new Rectangle((game.Window.ClientBounds.Width) / 2 - menuBox.Width + 330, 230, checkboxWidth, checkboxHeight);
            musicVolumeRectangle        = new Rectangle((game.Window.ClientBounds.Width) / 2 - menuBox.Width + 330, 330, musicVolumeTexture.Width, musicVolumeTexture.Height);
            musicVolumeInputRectangle   = new Rectangle((game.Window.ClientBounds.Width) / 2 - menuBox.Width + 330, 330, musicVolumeTexture.Width, musicVolumeTexture.Height);
            muteSoundEffectsRectangle   = new Rectangle((game.Window.ClientBounds.Width) / 2 - menuBox.Width + 330, 280, checkboxWidth, checkboxHeight);
            soundEVolumeRectangle       = new Rectangle((game.Window.ClientBounds.Width) / 2 - menuBox.Width + 330, 380, musicVolumeTexture.Width, musicVolumeTexture.Height);
            soundEVolumeInputRectangle  = new Rectangle((game.Window.ClientBounds.Width) / 2 - menuBox.Width + 330, 380, musicVolumeTexture.Width, musicVolumeTexture.Height);

            //Knappar
            backButton              = new Button(backButtonTexture, backButtonRectangle);
            muteMusicButton         = new Button(checkboxTextureOff, muteMusicRectangle);
            muteSoundEffectsButton  = new Button(checkboxTextureOff, muteSoundEffectsRectangle);
            fullscreenButton        = new Button(checkboxTextureOff, fullscreenRectangle);
            vsyncButton             = new Button(checkboxTextureOn, vsyncRectangle);
        }