Пример #1
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);
     player.LoadContent();
     scoreFont = Content.Load <SpriteFont>("defaultFont");
     level1.LoadContent();
     level2.LoadContent();
     level3.LoadContent();
     gameOver.LoadContent();
     winner.LoadContent();
     // TODO: use this.Content to load your game content here
 }
Пример #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);
            player.LoadContent();
            scoreFont = Content.Load <SpriteFont>("defaultFont");

            List <Tuple <int, int, int> > level1WallPositions  = new List <Tuple <int, int, int> >();
            List <Tuple <int, int> >      level1SpikePositions = new List <Tuple <int, int> >();
            //StreamReader wallReader1 = new StreamReader("../../../../../Level1WallPlacements.txt");
            string rawWall1  = Properties.Resources.Level1WallPlacements;
            string rawSpike1 = Properties.Resources.Level1SpikePlacements;

            string[] values;
            string[] line = rawWall1.Split('\n');
            foreach (string pair in line)
            {
                values = pair.Split(' ');
                level1WallPositions.Add(new Tuple <int, int, int>(Convert.ToInt32(values[0]),
                                                                  Convert.ToInt32(values[1]),
                                                                  Convert.ToInt32(values[2])));
            }
            line = rawSpike1.Split('\n');
            foreach (string pair in line)
            {
                values = pair.Split(' ');
                level1SpikePositions.Add(new Tuple <int, int>(Convert.ToInt32(values[0]),
                                                              Convert.ToInt32(values[1])));
            }
            levels.Add(0, level1);

            List <Tuple <int, int, int> > level2WallPositions  = new List <Tuple <int, int, int> >();
            List <Tuple <int, int> >      level2SpikePositions = new List <Tuple <int, int> >();
            string rawWall2  = Properties.Resources.Level2WallPlacements;
            string rawSpike2 = Properties.Resources.Level2SpikePlacements;

            line = rawWall2.Split('\n');
            foreach (string pair in line)
            {
                values = pair.Split(' ');
                level2WallPositions.Add(new Tuple <int, int, int>(Convert.ToInt32(values[0]),
                                                                  Convert.ToInt32(values[1]),
                                                                  Convert.ToInt32(values[2])));
            }
            line = rawSpike2.Split('\n');
            foreach (string pair in line)
            {
                values = pair.Split(' ');
                level2SpikePositions.Add(new Tuple <int, int>(Convert.ToInt32(values[0]),
                                                              Convert.ToInt32(values[1])));
            }
            levels.Add(1, level2);

            List <Tuple <int, int, int> > level3WallPositions  = new List <Tuple <int, int, int> >();
            List <Tuple <int, int> >      level3SpikePositions = new List <Tuple <int, int> >();
            string rawWall3  = Properties.Resources.Level3WallPlacements;
            string rawSpike3 = Properties.Resources.Level3SpikePlacements;

            line = rawWall3.Split('\n');
            foreach (string pair in line)
            {
                values = pair.Split(' ');
                level3WallPositions.Add(new Tuple <int, int, int>(Convert.ToInt32(values[0]),
                                                                  Convert.ToInt32(values[1]),
                                                                  Convert.ToInt32(values[2])));
            }
            line = rawSpike3.Split('\n');
            foreach (string pair in line)
            {
                values = pair.Split(' ');
                level3SpikePositions.Add(new Tuple <int, int>(Convert.ToInt32(values[0]),
                                                              Convert.ToInt32(values[1])));
            }
            levels.Add(2, level3);
            level1.LoadContent(level1WallPositions, level1SpikePositions, new Vector2(1, 351), new Vector2(1001, 351));
            level2.LoadContent(level2WallPositions, level2SpikePositions, new Vector2(1, 351), new Vector2(1001, 651));
            level3.LoadContent(level3WallPositions, level3SpikePositions, new Vector2(1, 651), new Vector2(1001, 201));
            gameOver.LoadContent();
            winner.LoadContent();
            // TODO: use this.Content to load your game content here
        }