Exemple #1
0
 public RLTile(
     RLTileMap _map,
     int _x,
     int _y
 )
 {
     Map = _map;
     X = _x;
     Y = _y;
 }
Exemple #2
0
        public RLGame()
        {
            World = new RLTileMap(16, 9);
            EventQueue = new List<IEvent>();
            EventListeners = new List<IEventListener>();

            Random = new Random();
            Quit = false;

            RLSaveIO.Setup();

            //Player = new RLCreature();
            playerInput = new PlayerInput(this);

            log = new List<string>();
            Log("foo");
            Log("bar");

            //dbg
            Test _test = new Test(this);
        }
Exemple #3
0
        public static List<string> SaveLevel(
            string _path,
            RLTileMap _tileMap,
            List<RLCreature> _creatures
        )
        {
            List<string> _level = new List<string>();

            _level.Add("#Tilemaps");
            _level.Add(_tileMap.CreateSaveString());

            _level.Add("#Tiles");
            for (int _x = 0; _x < _tileMap.Width; _x++)
            {
                for (int _y = 0; _y < _tileMap.Width; _y++)
                {
                    if (_tileMap[_x, _y] != null)
                        _level.Add(_tileMap[_x, _y].CreateSaveString());
                }
            }

            _level.Add("#Creatures");
            foreach (RLCreature _c in _creatures)
                _level.Add(_c.CreateSaveString());

            File.WriteAllLines(_path, _level);
            return _level;
        }
Exemple #4
0
        //move loads to their respective classes, by the createsavestring
        public static RLTileMap LoadTileMap(string _tilemapstring)
        {
            List<string> _elements =
                _tilemapstring.Split(
                    new char[] { ';' } //wtf
            ).ToList();

            List<string> _size =
                _elements[1].Split(
                    new char[] { ',' }
            ).ToList();

            int _ID;
            int _width;
            int _height;

            Int32.TryParse(_elements[0], out _ID);
            Int32.TryParse(_size[0], out _width);
            Int32.TryParse(_size[1], out _height);

            RLTileMap _return = new RLTileMap(_width, _height);
            _return.ID = _ID;

            return _return;
        }