コード例 #1
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            gameFont     = content.Load <SpriteFont>("gamefont");
            GameOverFont = content.Load <SpriteFont>("GameOver");
            /////My stuff

            player1 = new PlayerObject();

            player1.texture  = content.Load <Texture2D>("Sprites/semicircleV4");
            player1.position = new Vector2(0, 780);
            foreach (GameObject w in player1.weapon1)
            {
                w.texture = content.Load <Texture2D>("Sprites/w1V2");
            }

            max_enemies1 = 10;
            enemies1     = new EnemyObject[max_enemies1];
            for (int i = 0; i < max_enemies1; i++)
            {
                enemies1[i]         = new EnemyObject();
                enemies1[i].texture = content.Load <Texture2D>("Sprites/enemy1V1");
                enemies1[i].speed   = 1;
            }

            spawnRate        = 10;
            spawntimeCounter = 0;
            spawnPosition    = new Vector2(200, 400);



            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.
            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();
        }
コード例 #2
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            gameFont = content.Load<SpriteFont>("gamefont");
            GameOverFont = content.Load<SpriteFont>("GameOver");
            /////My stuff

            player1 = new PlayerObject();

            player1.texture = content.Load<Texture2D>("Sprites/semicircleV4");
            player1.position = new Vector2(0, 780);
            foreach (GameObject w in player1.weapon1)
            {

                w.texture = content.Load<Texture2D>("Sprites/w1V2");
            }

            max_enemies1 = 10;
            enemies1 = new EnemyObject[max_enemies1];
            for (int i = 0; i < max_enemies1; i++)
            {
                enemies1[i] = new EnemyObject();
                enemies1[i].texture = content.Load<Texture2D>("Sprites/enemy1V1");
                enemies1[i].speed = 1;

            }

            spawnRate = 10;
            spawntimeCounter = 0;
            spawnPosition = new Vector2(200, 400);

            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.
            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();
        }