Example #1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            KeyboardState stat = Keyboard.GetState();
            if (stat.IsKeyDown(Keys.Escape) || ExitGame)
            {
                this.Exit();
            }
            FrameInfo.GameTime = gameTime;

            //Henter inn mouseState på starten av Update, så den ikke kan endre seg underveis
            FrameInfo.MouseState = Mouse.GetState();

            if (NextState != null)
            {
                ActiveGameState = NextState;
                ActiveGameState.Reset();
                NextState = null;
            }

            ActiveGameState.Update();

            base.Update(gameTime);
        }
Example #2
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);

            GameStates.Add(new SimpleSplash(SpriteBatch, Content, "Images/introScreen", 0));
            GameStates.Add(new menuSplash(SpriteBatch, Content, "Images/menu",
                "Images/playButton", "Images/howToPlayButton", "Images/creditsButton", "Images/quitButton", 1));
            GameStates.Add(new SimpleSplash(SpriteBatch, Content, "Images/howToPlay", 2));
            GameStates.Add(new SimpleSplash(SpriteBatch, Content, "Images/createdBy", 3));
            GameStates.Add(new LevelSelecter(SpriteBatch, Content, "Images/selectLevel", 4));
            GameStates.Add(new menuSplash(SpriteBatch, Content, "Images/levelCleared",
                "Images/replayButton", "Images/nextLevel", "Images/selectLevelButton2", "Images/menuButton2", 5));
            GameStates.Add(new menuSplash(SpriteBatch, Content, "Images/gameOver",
                "Images/tryAgainButton", "Images/selectLevelButton", "Images/menuButton", "Images/RAGEQUITbutton", 6));
            GameStates.Add(new Level1(SpriteBatch, Content, 7));
            GameStates.Add(new Level2(SpriteBatch, Content, 8));
            GameStates.Add(new Level3(SpriteBatch, Content, 9));
            GameStates.Add(new Level4(SpriteBatch, Content, 10));

            ActiveGameState = GameStates[0];
        }