Esempio n. 1
0
 public void AddMap(Map map)
 {
     this.maps.Add(map);
 }
Esempio n. 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //screensize for zune, hitting ctrl+alt+del in vista and then canceling resizes the default screen size to a zune size. (although your monitor will still make it look bigger)
            titleSong = Content.Load<Song>("titlescreen");
            worldSong = Content.Load<Song>("world1");
            battleSong = Content.Load<Song>("battle");

            MediaPlayer.IsRepeating = true;
            MediaPlayer.Play(titleSong);

            TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0);

            testMap = new Map();
            testMap.GetMapDataFromFile("map.txt");
            testMap.GetTilesetData(Content.Load<Texture2D>("overworldtileset"));

            testMap2 = new Map();
            testMap2.GetMapDataFromFile("map2.txt");
            testMap2.GetTilesetData(Content.Load<Texture2D>("overworldtileset"));

            IList<Map> testMaps = new List<Map>();
            testMaps.Add(testMap);
            testMaps.Add(testMap2);

            //testMap.WriteFile("test1.txt");

            pm = new PlayerManager(this);
            bs = new BattleSystem(this, pm.player);
            sg = new StaticGraphics(this, pm.player);
            ta = new TileEngine(this, pm.player, testMaps, newKeyboardState, newGamePadState);

            // for randomly filling a map with tiles, I used the following code to fill a large map with varying tiles to check performance.

            /*Random r = new Random();

            for(int i = 0; i < mymap.layer[i].tileMap.GetUpperBound(0)+1; i++)
            {

                for (int j = 0; j < mymap.layer[i].tileMap.GetUpperBound(1)+1; j++)
                {
                    mymap.layer[i].tileMap[i, j] = r.Next(tilePalette.GetLength(0));
                }

            }*/

            //mymap.layer[i].tileMap[2, 2] = 1;

            base.Initialize();
        }
Esempio n. 3
0
 public void RemoveMap(Map map)
 {
     this.maps.Remove(map);
 }