Example #1
0
        /// <summary>
        /// Initializes the screen and applies the correct resolution and adds all gamestates to the gamestate manager.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            screen     = new Point(1900, 1050);
            windowSize = new Point(1280, 720);
            FullScreen = false;
            ApplyResolutionSettings();
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            // TODO: use this.Content to load your game content here
            gameStateManager.AddGameState("titleMenu", new TitleMenuState());
            GameStateManager.AddGameState("settingsState", new SettingsState());
            gameStateManager.AddGameState("characterSelection", new CharacterSelection());

            //Weghalen als characterselection eenmaal definitief aan staat, anders maakt hij al deze dingen opnieuw aan TO DO
            //Kan niet in plaats van in Characterselection hier aangemaakt worden, omdat dan de keuze niet goed wordt doorgegeven aan playingstate
            //als ik daar alleen playingstate zou zetten, is de volgorde niet meer goed.

            /*
             * gameStateManager.AddGameState("playingState", new PlayingState()); //Deze VERWIJDEREN ALS CHAR SELECTION IS GEACTIVEERD
             * gameStateManager.AddGameState("levelFinishedState", new LevelFinishedState());
             * GameStateManager.AddGameState("pauseState", new PauseState());
             * gameStateManager.AddGameState("conversation", new ConversationState());
             * gameStateManager.AddGameState("cutscene", new CutsceneState());*/

            gameStateManager.SwitchTo("titleMenu");
        }
Example #2
0
        public Kreen()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            // Set resolution
            graphics.PreferredBackBufferWidth  = 1280;
            graphics.PreferredBackBufferHeight = 720;

            graphics.IsFullScreen        = false;
            graphics.PreferMultiSampling = false;

            graphics.SynchronizeWithVerticalRetrace = true;
            this.IsFixedTimeStep = true;

            gameStateManager = new GameStateManager(this);
            bloomComponent   = new BloomComponent(this);

            Components.Add(gameStateManager);
            Components.Add(bloomComponent);

#if DEBUG
            FPS fps = new FPS(this);
            Components.Add(fps);
#endif

            // Add initial game state
            gameStateManager.AddGameState(new StateMenu(gameStateManager));
        }
Example #3
0
    protected override void LoadContent()
    {
        base.LoadContent();

        // set a custom world and window size
        worldSize  = new Point(1440, 825);
        windowSize = new Point(1024, 586);

        // to let these settings take effect, we need to set the FullScreen property again
        FullScreen = false;

        // load the player's progress from a file
        LoadProgress();

        // add the game states
        GameStateManager.AddGameState(StateName_Title, new TitleMenuState());
        GameStateManager.AddGameState(StateName_LevelSelect, new LevelMenuState());
        GameStateManager.AddGameState(StateName_Help, new HelpState());
        GameStateManager.AddGameState(StateName_Playing, new PlayingState());

        // start at the title screen
        GameStateManager.SwitchTo(StateName_Title);

        // play background music
        AssetManager.PlaySong("Sounds/snd_music", true);
    }
Example #4
0
        protected override void LoadContent()
        {
            base.LoadContent();

            // set a custom world and window size
            worldSize  = new Point(700, 1200);
            windowSize = new Point(350, 600);

            // to let these settings take effect, we need to set the FullScreen property again
            FullScreen = false;


            // add the game states
            GameStateManager.AddGameState(StateName.Home, new HomeState());
            GameStateManager.AddGameState(StateName.Play, new PlayState());
            GameStateManager.AddGameState(StateName.ChangeBall, new ChangeBallState());


            // start at the home screen
            GameStateManager.SwitchTo(StateName.Home);

            // hanlde volumn state

            bool isMuted = GameSettingHelper.GetVolumnState();

            MediaPlayer.IsMuted      = isMuted;
            SoundEffect.MasterVolume = isMuted ? 0f : 1f;

            // play background music
            AssetManager.PlaySong("Sounds/snd_music", true);
        }
Example #5
0
        protected override void LoadContent()
        {
            base.LoadContent();
            bgMusic                      = AssetManager.Content.Load <SoundEffect>("Sound/Background_music");
            soundEffectInstance          = bgMusic.CreateInstance();
            soundEffectInstance.IsLooped = true;
            soundEffectInstance.Play();
            screen = new Point(1920, 1080);
            ApplyResolutionSettings();

            FullScreen = true;

            GameStateManager.AddGameState("StartState", new StartState());
            GameStateManager.AddGameState("Level1", new Level1());
            GameStateManager.AddGameState("Level2", new Level2());
            GameStateManager.AddGameState("Level3", new Level3());
            GameStateManager.AddGameState("Level4", new Level4());
            GameStateManager.AddGameState("Level5", new Level5());
            GameStateManager.AddGameState("EndStateWon", new EndStateWon());
            GameStateManager.AddGameState("EndStateLost", new EndStateLost());
            GameStateManager.AddGameState("ExplanationState", new ExplanationState());
            GameStateManager.AddGameState("ExplanationStateTwo", new ExplanationStateTwo());


            GameStateManager.SwitchTo("StartState");
        }
Example #6
0
        protected override void Initialize()
        {
            // Create GameStateManager and add it to components
            stateManager = new GameStateManager(this, "Fonts/defaultfont");
            Components.Add(stateManager);

            // Create game states
            playingState  = new PlayingState();
            mainMenuState = new MainMenuState(playingState);
            mainMenuState.StatusChanged += mainMenuState_StatusChanged;
            stateManager.AddGameState(mainMenuState);
            stateManager.AddGameState(playingState);

            this.IsMouseVisible = true;
            base.Initialize();
            stateManager.SwitchToState(mainMenuState);
        }
Example #7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();
            Screen = new Point(1000, 552);
            ApplyResolutionSettings();

            GameStateManager.AddGameState("PlayingState", new PlayingState());
            GameStateManager.SwitchTo("PlayingState");
        }
Example #8
0
        protected override void LoadContent()
        {
            base.LoadContent();
            Screen = new Point(800, 600);
            ApplyResolutionSettings();

            // Add the game states and call the first one.
            GameStateManager.AddGameState("Play", new RaceState());
            GameStateManager.SwitchTo("Play");
        }
Example #9
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();
            Screen = new Point(1200, 800);
            ApplyResolutionSettings();

            GameStateManager.AddGameState("PlayingState", new PlayingState());
            GameStateManager.SwitchTo("PlayingState");

            IsMouseVisible = true;
        }
Example #10
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();
            Screen = new Point(800, 950);
            ApplyResolutionSettings();

            // TODO: use this.Content to load your game content here
            GameStateManager.AddGameState("PlayingState", new PlayingState());
            GameStateManager.AddGameState("GameOverState", new GameOverState());
            GameStateManager.SwitchTo("PlayingState");
        }
Example #11
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            screen      = new Point(1920, 1080);
            ApplyResolutionSettings();

            // TODO: use this.Content to load your game content here
            GameStateManager.AddGameState("PlayingState", new PlayingState());
            GameStateManager.SwitchTo("PlayingState");
        }
Example #12
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            screen      = new Point(800, 600);
            SetFullScreen(false);
            IsMouseVisible = true;

            // TODO: use this.Content to load your game content here
            gameStateManager.AddGameState("PlayingState", new PlayingState());
            GameStateManager.AddGameState("GameOverState", new GameOverState());
            gameStateManager.SwitchTo("PlayingState");
        }
Example #13
0
        public void UpdateSelectedItem(GameTime gameTime)
        {
            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

            _timeSinceLastUpdate += elapsed;

            if (_timeSinceLastUpdate < _updateInterval)
            {
                return;
            }

            if (IsSelected())
            {
                if (_selectedItemIndex == 0)
                {
                    // start game
                    GameStateManager gameStateManager = (GameStateManager)Game.Services.GetService(typeof(GameStateManager));
                    gameStateManager.AddGameState(new PlayingGameState(Game));
                }
                if (_selectedItemIndex == 1)
                {
                    // show help
                }
                if (_selectedItemIndex == 2)
                {
                    Game.Exit();
                }
            }

            if (IsMovingUp())
            {
                _selectedItemIndex--;
            }

            if (IsMovingDown())
            {
                _selectedItemIndex++;
            }


            if (_selectedItemIndex < 0)
            {
                _selectedItemIndex = _menuItems.Count - 1;
            }

            if (_selectedItemIndex >= _menuItems.Count)
            {
                _selectedItemIndex = 0;
            }

            _timeSinceLastUpdate -= _updateInterval;
        }
Example #14
0
        protected override void LoadContent()
        {
            base.LoadContent();
            // Create a new SpriteBatch, which can be used to draw textures.
            screen = new Point(1280, 720);
            ApplyResolutionSettings();

            PlayingState playingState = new PlayingState();

            GameStateManager.AddGameState("StartState", new StartState(playingState));
            GameStateManager.SwitchTo("StartState");
            GameStateManager.AddGameState("PlayState", playingState);
        }
Example #15
0
        protected override void Initialize()
        {
            stateManager = new GameStateManager(this, "Fonts/defaultfont");
            state2       = new GamingState("Game");
            physicsState = new PhysicsState("Physics test");
            state1       = new MainMenuState("Main Menu", state2, physicsState);
            pauseState   = new PauseState("Paused");
            stateManager.AddGameState(state1);
            stateManager.AddGameState(state2);
            stateManager.AddGameState(physicsState);
            stateManager.AddGameState(pauseState, true);
            state1.StatusChanged       += this.TestStateStatusChanged;
            state2.StatusChanged       += this.TestStateStatusChanged;
            pauseState.StatusChanged   += this.TestStateStatusChanged;
            physicsState.StatusChanged += this.TestStateStatusChanged;
            Components.Add(stateManager);
            this.IsMouseVisible = true;
            base.Initialize();

            // Activate our first state, which surprisingly is the MainMenuState
            stateManager.SwitchToState(state1);
        }
Example #16
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();
            screen = new Point(600, 800);
            ApplyResolutionSettings();

            // TODO: use this.Content to load your game content here
            GameStateManager.AddGameState("PlayingState", new PlayingState());
            GameStateManager.AddGameState("DeathState", new DeathState());
            GameStateManager.AddGameState("TitleScreen", new TitleScreenState());

            GameStateManager.SwitchTo("TitleScreen");
        }
Example #17
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            screen      = new Point(470, 550);
            SetFullScreen(false);

            gameStateManager.AddGameState(playingState, new PlayingState());
            GameStateManager.AddGameState(gameoverState, new GameoverState());
            gameStateManager.SwitchTo(playingState);

            // TODO: Add game states to GameStateManager here
        }
Example #18
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();
            font   = Content.Load <SpriteFont>("font");//hier laadt ik de font in
            Screen = new Point(880, 880);
            ApplyResolutionSettings();

            // TODO: use this.Content to load your game content here
            thePlayingstate = new GameStates.Playingstate(rows, columns);

            GameStateManager.AddGameState("Play", thePlayingstate);
            GameStateManager.AddGameState("Begin", new GameStates.Beginstate());
            GameStateManager.SwitchTo("Begin");
        }
Example #19
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            screen      = new Point(800, 550);
            ApplyResolutionSettings();

            // TODO: use this.Content to load your game content here
            GameStateManager.AddGameState("playingstate", new PlayingState());
            GameStateManager.AddGameState("gameover", new GameOver());
            GameStateManager.AddGameState("titlescreen", new Titlescreen());
            GameStateManager.AddGameState("victory", new VictoryScreen());
            gameStateManager.SwitchTo("titlescreen");
        }
Example #20
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            screen      = new Point(1920, 1080);
            ApplyResolutionSettings();

            GameStateManager.AddGameState("PlayingState", new PlayingState());
            GameStateManager.AddGameState("StartState", new StartState());
            GameStateManager.AddGameState("GameOverState", new GameOverState());
            GameStateManager.AddGameState("WinState", new WinState());

            GameStateManager.SwitchTo("StartState");
        }
Example #21
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            screen      = new Point(1280, 720);
            ApplyResolutionSettings();

            // TODO: use this.Content to load your game content here
            GameStateManager.AddGameState("StartingState", new StartingState());
            GameStateManager.AddGameState("PlayingState", new PlayingState());
            GameStateManager.AddGameState("PausedState", new PausedState());
            GameStateManager.AddGameState("GameOverState", new GameOverState());
            GameStateManager.AddGameState("VictoryState", new VictoryState());

            GameStateManager.SwitchTo("StartingState"); //SWITCH TO STARTINGSTATE ONCE GAME WORKS
        }
Example #22
0
        protected override void LoadContent()
        {
            //load background
            base.LoadContent();
            //Console.Write("Loading content");
            screen = new Point(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
            //add gamestate
            GameStateManager.AddGameState("playingState", new PainterGameWorld());
            GameStateManager.AddGameState("GameOverState", new GameOver());
            GameStateManager.AddGameState("StartState", new StartState());

            //default gamestate
            GameStateManager.SwitchTo("StartState");
            //play music
            //AssetManager.PlayMusic("snd_music");
        }
Example #23
0
    protected override void LoadContent()
    {
        base.LoadContent();
        screen     = new Point(1920, 1080);
        windowSize = new Point(1600, 900);
        FullScreen = false;

        framecounter            = new TextGameObject("Fonts/Hud", 101, "framecounter");
        framecounter.Position   = new Vector2(10, 10);
        framecounter.Color      = Color.Black;
        physicscounter          = new TextGameObject("Fonts/Hud", 101, "physicscounter");
        physicscounter.Position = new Vector2(10, 30);
        physicscounter.Color    = Color.Black;

        gameStateManager.AddGameState("editorState", new EditorState(Content));
        GameStateManager.AddGameState("selectionState", new SelectionState(Content));
        gameStateManager.SwitchTo("selectionState");
    }
        protected override void LoadContent()
        {
            base.LoadContent();
            Screen     = new Point(1200, 900);
            windowSize = new Point(1024, 768);

            GameStateManager.AddGameState(GameState.PlayingState, new PlayingState(Content));
            GameStateManager.AddGameState(GameState.TitleMenu, new TitleMenuState());
            GameStateManager.AddGameState(GameState.OptionsMenu, new OptionsMenuState());
            GameStateManager.AddGameState(GameState.LevelMenu, new LevelMenuState());
            GameStateManager.AddGameState(GameState.HelpMenu, new HelpMenuState());
            GameStateManager.AddGameState(GameState.LevelFinishedState, new LevelFinishedState());

            GameStateManager.SwitchTo(GameState.TitleMenu);

            ApplyResolutionSettings();
            Window.Position = new Point((GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width - windowSize.X) / 2, (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height - windowSize.Y) / 2);
        }
Example #25
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            screen      = new Point(470, 550);
            ApplyResolutionSettings();

            GameStateManager.AddGameState("Start", new StartScreen());
            GameStateManager.AddGameState("PlayingState", new PlayingState());
            GameStateManager.AddGameState("GameOver", new GameOverScreen());

            GameStateManager.SwitchTo("Start");

            this.song          = Content.Load <Song>("BestSongEver");
            MediaPlayer.Volume = 0.20f;
            MediaPlayer.Play(song);
            MediaPlayer.IsRepeating = true;
            // TODO: use this.Content to load your game content here
        }
Example #26
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            screen      = new Point(1080, 920);
            ApplyResolutionSettings();

            // TODO: use this.Content to load your game content here

            playingState  = new PlayingState();
            gameOverState = new GameOverState();
            startState    = new StartState();
            winState      = new WinState();
            GameStateManager.AddGameState("playingstate", playingState);
            GameStateManager.AddGameState("gameOverState", gameOverState);
            GameStateManager.AddGameState("stateState", startState);
            gameStateManager.AddGameState("winState", winState);
            GameStateManager.SwitchTo("stateState");
        }
Example #27
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();
            Screen = new Point(800, 800);
            ApplyResolutionSettings();



            // TODO: use this.Content to load your game content here
            GameStateManager.AddGameState("Level1", new Level1());
            GameStateManager.AddGameState("Level2", new Level2());

            GameStateManager.AddGameState("TitleScreenState", new TitleScreenState());
            GameStateManager.AddGameState("WinState", new WinState());
            GameStateManager.AddGameState("GameOverState", new GameOverState());
            GameStateManager.AddGameState("Thank You For Playing", new ThankYouForPlayingState());


            GameStateManager.SwitchTo("TitleScreenState");
        }
        protected override void LoadContent()
        {
            base.LoadContent();
            worldSize  = new Point(1200, 900);
            windowSize = new Point(1024, 768);

            FullScreen = false;

            LoadProgress();

            GameStateManager.AddGameState(StateName_Title, new TitleMenuState());
            GameStateManager.AddGameState(StateName_Help, new HelpState());
            GameStateManager.AddGameState(StateName_LevelMenu, new LevelMenuState());
            GameStateManager.AddGameState(StateName_Options, new OptionsMenuState());
            GameStateManager.AddGameState(StateName_Playing, new PlayingState());

            GameStateManager.SwitchTo(StateName_Title);

            AssetManager.PlaySong("Sounds/snd_music", true);
        }
Example #29
0
    protected override void LoadContent()
    {
        base.LoadContent();

        // set a custom world and window size
        worldSize  = new Point(1200, 900);
        windowSize = new Point(1024, 768);

        // to let these settings take effect, we need to set the FullScreen property again
        FullScreen = false;

        // add the game states
        GameStateManager.AddGameState(StateName_Title, new TitleMenuState());
        GameStateManager.AddGameState(StateName_Options, new OptionsMenuState());
        GameStateManager.AddGameState(StateName_LevelSelect, new LevelMenuState());
        GameStateManager.AddGameState(StateName_Help, new HelpState());
        GameStateManager.AddGameState(StateName_Playing, new PlayingState());

        // start at the title screen
        GameStateManager.SwitchTo(StateName_Title);
    }
Example #30
0
        //private TextureManager _textureManager;

        public PongGame()
        {
            _graphics             = new GraphicsDeviceManager(this);
            _collisionManager     = new CollisionManager();
            _entityFactory        = new EntityFactory(this);
            Content.RootDirectory = "Content";
            _gameStateManager     = new GameStateManager(this);
            //_textureManager = new TextureManager(this);

            //_gameStateManager.AddGameState(new PlayingGameState(this));
            _gameStateManager.AddGameState(new InitializingGameState(this));


            //Components.Add(_textureManager);
            Components.Add(_gameStateManager);


            //Services.AddService(typeof(ITextureManager), _textureManager);
            Services.AddService(typeof(IEntityFactory), _entityFactory);
            Services.AddService(typeof(CollisionManager), _collisionManager);
            Services.AddService(typeof(ContentManager), Content);
            Services.AddService(typeof(GameStateManager), _gameStateManager);
        }