Esempio n. 1
0
        public GameWorld(State gameState, Dictionary<string, Tile> tiles, string mapFile)
        {
            _gameState = gameState;
            _tiles = tiles;

            //Read in the map file
            readMapfile(mapFile);

            //Find the start point
            _currentArea = _world[_startArea];

            //Create and position the hero character
            _heroPosition = new Point(3, 3);
            _heroSprite = new Sprite(null, _heroPosition.X * Tile.TileSizeX + LocalArea.OffsetX,
                                            _heroPosition.Y * Tile.TileSizeY + LocalArea.OffsetY,
                                            _tiles["sha"].Bitmap, _tiles["sha"].Rectangle, _tiles["sha"].NumberOfFrames);
            _heroSprite.Flip = true;
            _heroSprite.ColorKey = Color.FromArgb(75, 75, 75);
        }
Esempio n. 2
0
 private void readMapfile(string mapFile)
 {
     using (StreamReader stream = new StreamReader(mapFile))
      {
          while (!stream.EndOfStream)
          {
              //Each area constructor will consume just one area
              LocalArea area = new LocalArea(stream, _tiles);
              _world.Add(area.Name, area);
          }
      }
 }