LoadContent() public method

Loads the player sprite sheet and sounds.
public LoadContent ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
content Microsoft.Xna.Framework.Content.ContentManager
return void
Example #1
0
        public override void LoadContent(ContentManager Content, InputManager inputManager)
        {
            base.LoadContent(Content, inputManager);

            map.LoadContent(Content);
            player.LoadContent(Content);

            txtScoreBar = Content.Load <Texture2D>(Values.txtScoreBar);
            ScoreBar    = new Sprite(txtScoreBar);
            ScoreBar.SetPosition(Values.scoreBarPosition);
        }
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);
     SpriteMap   = Content.Load <Texture2D>(@"Content\Sprites\spritemap");
     player.LoadContent(Content);
     foreach (var obj in level.Enemies)
     {
         obj.LoadContent(Content);
     }
     // TODO: use this.Content to load your game content here
     baseFont = Content.Load <SpriteFont>("Content/Fonts/baseFont");
 }
        /// <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);

            //load tilemap
            tilemap = Content.Load<Tilemap>("NNmap1");

            //load player
            player = new Player();
            player.LoadContent(Content);
            player.Tilemap = tilemap;
            player.LayerIndex = tilemap.PlayerStart.Layer;

            //need to modify this slightly more than 1 tile to the right
            player.Position = tilemap.PlayerStart.Position + new Vector2(60, 20);

            //target 30 fps for sped-up play, minimum for normal collision function
            //will need to scale this with time scale: based on framerate on desktop computer
            this.TargetElapsedTime = TimeSpan.FromSeconds(1.0f / 60.0f);

            //heart = Content.Load<Texture2D>("heart");

            //load camera
            camera = new Camera(GraphicsDevice, tilemap);
            camera.Target = player;

            //enemies = new List<Enemy>();
            //if (tilemap.EnemyLocations != null)
            //{
            //    foreach (EnemyStart e in tilemap.EnemyLocations)
            //    {
            //        enemies.Add(new Enemy(e.MonsterType, e.Layer, e.Position));
            //    }
            //}

            //gems = new List<Gem>();
            //if (tilemap.Gems != null)
            //{
            //    foreach (GemLocation g in tilemap.Gems)
            //    {
            //        gems.Add(new Gem(g.GemType, g.Layer, g.Position));
            //    }
            //}

            //Licensed under Creative Commons Attribution - from freemusicarchive.org
            //bgSong = Content.Load<Song>("Sounds/Rolemusic - Leafless_Quince_Tree");

            spriteFont = Content.Load<SpriteFont>("SpriteFont1");

            //MediaPlayer.Play(bgSong);

            gameState = GameState.Start;
        }
        /// <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);

            //load tilemap
            tilemap = Content.Load<Tilemap>("Map2");

            //load player
            player = new Player();
            player.LoadContent(Content);
            player.Tilemap = tilemap;
            player.LayerIndex = tilemap.PlayerStart.Layer;
            player.Position = tilemap.PlayerStart.Position;

            //heart = Content.Load<Texture2D>("heart");

            //load camera
            camera = new Camera(GraphicsDevice, tilemap);
            camera.Target = player;

            //enemies = new List<Enemy>();
            //if (tilemap.EnemyLocations != null)
            //{
            //    foreach (EnemyStart e in tilemap.EnemyLocations)
            //    {
            //        enemies.Add(new Enemy(e.MonsterType, e.Layer, e.Position));
            //    }
            //}

            //gems = new List<Gem>();
            //if (tilemap.Gems != null)
            //{
            //    foreach (GemLocation g in tilemap.Gems)
            //    {
            //        gems.Add(new Gem(g.GemType, g.Layer, g.Position));
            //    }
            //}

            //Licensed under Creative Commons Attribution - from freemusicarchive.org
            //bgSong = Content.Load<Song>("Sounds/Rolemusic - Leafless_Quince_Tree");

            spriteFont = Content.Load<SpriteFont>("SpriteFont1");

            //MediaPlayer.Play(bgSong);

            gameState = GameState.Start;
        }