コード例 #1
0
ファイル: GameplayScreen.cs プロジェクト: olliwer/angry_nerds
        /*
         * Load graphics content for the game.
         */
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content/GraphicsContent");
            }
            gameFont = content.Load<SpriteFont>("menufont");
            /*
             * Adding the background
             */
            mBackgroundOne = new Sprite();
            mBackgroundOne.LoadContent(this.content, "Background01");
            mBackgroundOne.Position = new Vector2(0, 0);
            mBackgroundOne.Scale = 1;

            /*
             * Adding the projectile penguin
             */
            nerd = new Nerd();
            nerd.LoadContent(this.content, 150, 600);
            ammukset = nerd.ammukset;

            /*
             * Adding the walls and targets
             */
            target = new Sika();
            target.Scale = 0.3F;
            target.value = 3;
            target.LoadContent(this.content, 800, 500, "birdy");

            target2 = new Sika();
            target2.Scale = 0.3F;
            target2.value = 5;
            target2.LoadContent(this.content, 700, 600, "birdy");

            target3 = new Sika();
            target3.Scale = 0.3F;
            target3.value = 7;
            target3.LoadContent(this.content, 700, 300, "birdy");

            target4 = new Sika();
            target4.Scale = 0.3F;
            target4.value = 10;
            target4.LoadContent(this.content, 480, 550, "birdy");

            target5 = new Sika();
            target5.Scale = 0.3F;
            target5.value = 8;
            target5.LoadContent(this.content, 500, 200, "birdy");

            wall = new Tile();

            wall.LoadContent(this.content, 400, 500, "tile2");

            wall.LoadContent(this.content, 400, 500, "tile3");

            wall2 = new Tile();
            wall2.LoadContent(this.content, 400, 530, "tile3");

            wall3 = new Tile();
            wall3.LoadContent(this.content, 400, 560, "tile3");

            wall4 = new Tile();
            wall4.LoadContent(this.content, 400, 590, "tile3");

            wall5 = new Tile();
            wall5.LoadContent(this.content, 400, 620, "tile3");

            wall6 = new Tile();
            wall6.LoadContent(this.content, 400, 650, "tile3");

            wall7 = new Tile();
            wall7.LoadContent(this.content, 400, 680, "tile3");

               /*
            * A super cool one second wait when the load is finished to make the illusion our game is heavy
            */
            Thread.Sleep(1000);

            ScreenManager.Game.ResetElapsedTime();
        }
コード例 #2
0
ファイル: GameplayScreen.cs プロジェクト: Saturnina/AN
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content/GraphicsContent");
            }

            gameFont = content.Load<SpriteFont>("menufont");
               // spriteBatch = new SpriteBatch(GraphicsDevice);

            //määritellään background
            mBackgroundOne = new Sprite();
            mBackgroundOne.LoadContent(this.content, "Background01");
            mBackgroundOne.Position = new Vector2(0, 0);
            mBackgroundOne.Scale = 1;

            //määrritellään tuxi
            nerd = new Nerd();
            nerd.LoadContent(this.content);
            nerd.Position.X = 800;
            nerd.Position.Y = 300;

            //tarkoitus tehdä tästä "possu"
            target = new Sika();
            target.LoadContent(this.content);
            target.Position.X = 900;
            target.Position.Y = 600;

               // mBackgroundTwo.LoadContent(this.content, "Background02");
               // mBackgroundTwo.Position = new Vector2(mBackgroundOne.Position.X + mBackgroundOne.Size.Width, 0);

            //mBackgroundThree.LoadContent(this.Content, "Background03");
            //mBackgroundThree.Position = new Vector2(mBackgroundTwo.Position.X + mBackgroundTwo.Size.Width, 0);

            //mBackgroundFour.LoadContent(this.Content, "Background04");
            //mBackgroundFour.Position = new Vector2(mBackgroundThree.Position.X + mBackgroundThree.Size.Width, 0);

            //mBackgroundFive.LoadContent(this.Content, "Background05");
            //mBackgroundFive.Position = new Vector2(mBackgroundFour.Position.X + mBackgroundFour.Size.Width, 0);

            //lintu

               //tämän voi poistaa lopullisesta, mutta antaa paremman fiiliksen kun load screeni näkyy hetken :)
            Thread.Sleep(1000);

            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();

            //vanhasta luokasta revitut dädät:

            // Create a new SpriteBatch, which can be used to draw textures.

            //mitä näillä tehdään?
            //mSprite.LoadContent(this.Content, "birdy");
            //mSprite.Position = new Vector2(125, 245);

            //mSpriteTwo.LoadContent(this.Content, "birdy");
            //mSpriteTwo.Position.X = 300;
            //mSpriteTwo.Position.Y = 300;
        }