Esempio n. 1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            graphics.PreferredBackBufferWidth  = GraphicsDevice.DisplayMode.Width;
            graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();

            gamestates = Gamestates.startmenu;

            // Inladning av alla textures
            #region Inladning av textures

            Texture2D playerSprite = Content.Load <Texture2D>("piggy");
            Texture2D playerCrouch = Content.Load <Texture2D>("Crouch");


            flyingsprite    = Content.Load <Texture2D>("snow123");
            objectSprite    = Content.Load <Texture2D>("flyingGrasBlock_100x30");
            damagesprite    = Content.Load <Texture2D>("grasBlock_100x60");
            background      = Content.Load <Texture2D>("Forest-31");
            munkSprite      = Content.Load <Texture2D>("snow123");
            backgroundWidth = background.Width;
            backgroundTest  = new Vector2(0, 0);

            //Meny bakgrunder
            #region Meny Bakgrunder
            startmenuTexture    = Content.Load <Texture2D>("title_screen_almost");
            shopmenuTexture     = Content.Load <Texture2D>("liten_shopscreen_test");
            pausemenuTexture    = Content.Load <Texture2D>("liten_pausescreen_test");
            levelmenuBackground = Content.Load <Texture2D>("levelmeny_bakgrund_utan");
            #endregion

            //Alla knappterturers
            #region Knapptexturers
            playButton       = Content.Load <Texture2D>("playButton");
            playButtonActive = Content.Load <Texture2D>("playButton_active");

            shopButton       = Content.Load <Texture2D>("shopButton");
            shopButtonActive = Content.Load <Texture2D>("shopButton_active");

            exitButton       = Content.Load <Texture2D>("exitButton");
            exitButtonActive = Content.Load <Texture2D>("exitButton_active");

            resumeButton       = Content.Load <Texture2D>("resumeButton");
            resumeButtonActive = Content.Load <Texture2D>("resumeButton_active");

            leaveButton       = Content.Load <Texture2D>("leaveButton");
            leaveButtonActive = Content.Load <Texture2D>("leaveButton_active");

            backButton       = Content.Load <Texture2D>("backButton");
            backButtonActive = Content.Load <Texture2D>("backButton_active");

            buyButton       = Content.Load <Texture2D>("buyButton");
            buyButtonActive = Content.Load <Texture2D>("buyButton_active");

            level1Texture     = Content.Load <Texture2D>("level-1");
            level1ZoomTexture = Content.Load <Texture2D>("level-1-zoom");

            level2Texture = Content.Load <Texture2D>("level-2");
            level3Texture = Content.Load <Texture2D>("level-3");
            level4Texture = Content.Load <Texture2D>("level-4");
            #endregion

            buyJump = Content.Load <SpriteFont>("BuyJump");
            #endregion

            startmenu = new Startmenu(startmenuTexture, playButton, playButtonActive, shopButton, shopButtonActive, exitButton, exitButtonActive);
            shopmenu  = new Shopmenu(shopmenuTexture, buyButton, buyButtonActive, backButton, backButtonActive);
            levelMenu = new LevelMenu(levelmenuBackground, backButton, backButtonActive);
            pausemenu = new Pausemenu(pausemenuTexture, resumeButton, resumeButtonActive, leaveButton, leaveButtonActive);
            player    = new Player(playerSprite, playerCrouch);

            base.Initialize();
        }
Esempio n. 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            graphics.PreferredBackBufferWidth  = GraphicsDevice.DisplayMode.Width;
            graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();

            gamestates = Gamestates.startmenu;

            // Inladning av alla textures
            #region Inladning av textures

            playerSprite = Content.Load <Texture2D>("piggy");
            Texture2D playerCrouch = Content.Load <Texture2D>("Crouch");
            healthTexture      = Content.Load <Texture2D>("health");
            grenSprite         = Content.Load <Texture2D>("GREN");
            flyingsprite       = Content.Load <Texture2D>("flygande_gren");
            groundBlockTexture = Content.Load <Texture2D>("srort_block");
            snowGroundTexture  = Content.Load <Texture2D>("snwo_groundblock");
            damagesprite       = Content.Load <Texture2D>("Mario_runing");
            background         = Content.Load <Texture2D>("Forest-31");
            munkSprite         = Content.Load <Texture2D>("sockerMunk_texture");
            backgroundWidth    = background.Width;
            backgroundTest     = new Vector2(0, 0);

            rainTexture = Content.Load <Texture2D>("rain");
            snowTexture = Content.Load <Texture2D>("big_snowflake2");

            //Meny bakgrunder
            #region Meny Bakgrunder
            Texture2D startmenuTexture    = Content.Load <Texture2D>("title_screen_almost");
            Texture2D shopmenuTexture     = Content.Load <Texture2D>("new_shop_screen");
            Texture2D pausemenuTexture    = Content.Load <Texture2D>("liten_pausescreen_test");
            Texture2D levelmenuTexture    = Content.Load <Texture2D>("levelmeny_bakgrund_utan");
            Texture2D gameOverMenuTexture = Content.Load <Texture2D>("new_gameOver_screen");
            Texture2D youWinMenuTexture   = Content.Load <Texture2D>("wining_screen");
            #endregion

            //Alla knappterturers
            #region Knapptexturers
            playButton       = Content.Load <Texture2D>("playButton");
            playButtonActive = Content.Load <Texture2D>("playButton_active");

            Texture2D shopButton       = Content.Load <Texture2D>("shopButton");
            Texture2D shopButtonActive = Content.Load <Texture2D>("shopButton_active");

            Texture2D exitButton       = Content.Load <Texture2D>("exitButton");
            Texture2D exitButtonActive = Content.Load <Texture2D>("exitButton_active");

            Texture2D resumeButton       = Content.Load <Texture2D>("resumeButton");
            Texture2D resumeButtonActive = Content.Load <Texture2D>("resumeButton_active");

            leaveButton       = Content.Load <Texture2D>("leaveButton");
            leaveButtonActive = Content.Load <Texture2D>("leaveButton_active");

            backButton       = Content.Load <Texture2D>("backButton");
            backButtonActive = Content.Load <Texture2D>("backButton_active");

            Texture2D buyButton       = Content.Load <Texture2D>("buyButton");
            Texture2D buyButtonActive = Content.Load <Texture2D>("buyButton_active");

            Texture2D easyButton       = Content.Load <Texture2D>("easy_button");
            Texture2D easyButtonActive = Content.Load <Texture2D>("easy_button_active");

            Texture2D normalButton       = Content.Load <Texture2D>("normal_button");
            Texture2D normalButtonActive = Content.Load <Texture2D>("normal_button_active");

            Texture2D hardButton       = Content.Load <Texture2D>("hard_button");
            Texture2D hardButtonActive = Content.Load <Texture2D>("hard_button_active");

            Texture2D sonicButton       = Content.Load <Texture2D>("sonic_button");
            Texture2D sonicButtonActive = Content.Load <Texture2D>("sonic_button_active");

            Texture2D level1Texture      = Content.Load <Texture2D>("level1_button");
            Texture2D level1TextureHover = Content.Load <Texture2D>("level1_button_active");

            Texture2D level2Texture      = Content.Load <Texture2D>("level2_button");
            Texture2D level2TextureHover = Content.Load <Texture2D>("level2_button_active");

            Texture2D level3Texture      = Content.Load <Texture2D>("level3_button");
            Texture2D level3TextureHover = Content.Load <Texture2D>("level3_button_active");

            Texture2D level4Texture      = Content.Load <Texture2D>("level4_button");
            Texture2D level4TextureHover = Content.Load <Texture2D>("level4_button_active");
            #endregion

            comicSansFont = Content.Load <SpriteFont>("BuyJump");
            #endregion

            startmenu    = new Startmenu(startmenuTexture, playButton, playButtonActive, shopButton, shopButtonActive, exitButton, exitButtonActive);
            shopmenu     = new Shopmenu(shopmenuTexture, buyButton, buyButtonActive, backButton, backButtonActive);
            levelMenu    = new LevelMenu(playButton, playButtonActive, levelmenuTexture, level1Texture, level1TextureHover, level2Texture, level2TextureHover, level3Texture, level3TextureHover, level4Texture, level4TextureHover, backButton, backButtonActive, easyButton, easyButtonActive, normalButton, normalButtonActive, hardButton, hardButtonActive, sonicButton, sonicButtonActive);
            pausemenu    = new Pausemenu(pausemenuTexture, resumeButton, resumeButtonActive, leaveButton, leaveButtonActive);
            player       = new Player(playerSprite, playerCrouch, healthTexture);
            gameOverMenu = new GameOverMenu(gameOverMenuTexture, backButton, backButtonActive, playButton, playButtonActive);
            youWinMenu   = new YouWinMenu(youWinMenuTexture, backButton, backButtonActive);

            base.Initialize();
        }