Ejemplo n.º 1
0
        // Load TileMap
        public static TileMap LoadTileMap(GameScreen screen, string path, Vector2 position)
        {
            TileMap map = new TileMap(screen);

            map.Position = position;

            StreamReader reader = new StreamReader(path);
            int          xPos   = (int)position.X;
            int          yPos   = (int)position.Y;

            map.Size.X = int.Parse(reader.ReadLine());
            map.Size.Y = int.Parse(reader.ReadLine());

            string line;

            while ((line = reader.ReadLine()) != null)
            {
                xPos = (int)position.X;
                for (int i = 0; i < line.Length; i++)
                {
                    if (line[i] != '*')
                    {
                        Ground.GROUND_TYPE groundType = (Ground.GROUND_TYPE) int.Parse(line[i].ToString());
                        Ground             ground     = Ground.MakeGround(screen, map, groundType);
                        map.GameObjects.Add(ground);
                        ground.Position.X = xPos;
                        ground.Position.Y = yPos;
                    }
                    xPos += (int)MainGame.TILE_SIZE.X;
                }
                yPos += (int)MainGame.TILE_SIZE.Y;
            }

            reader.Close();
            return(map);
        }
Ejemplo n.º 2
0
 // Add Destroy sound effectr
 public void AddDestroySoundEffect(Ground.GROUND_TYPE type, string path)
 {
     DestroySoundEffects.Add(type, Content.Load <SoundEffect>(path));
 }
Ejemplo n.º 3
0
 // Add a particle system
 public void AddParticleSystem(Ground.GROUND_TYPE type, ScreenParticleSystem system)
 {
     ParticleSystems.Add(type, system);
     Screen.ScreenParticleSystems.Add(system);
 }
Ejemplo n.º 4
0
 // Add a tile set
 public void AddTileSet(Ground.GROUND_TYPE type, string nameAndPath)
 {
     TileSets.Add(type, Content.Load <Texture2D>(nameAndPath));
 }