Beispiel #1
0
        private void LoadAssets()
        {
            this.treasures = new List<Image>();
            this.scorpions = new List<Scorpion>();
            this.beetles = new List<Beetle>();
            this.panel = new Panel(this.game, new Vector2(0f, 448f));
            this.lines = new List<string>();
            //StreamReader reader = new StreamReader(this.levelPath);
            StreamReader reader = new StreamReader(this.stream);
            string line = reader.ReadLine();
            int width = line.Length;
            while ( line != null)
            {
                lines.Add(line);
                line = reader.ReadLine();
            }
            int height = lines.Count;
            this.blocks = new Block[width, height];
            reader.Close();
            this.stream.Close();

            for (int row = 0; row < height; row++)
            {
                for (int column = 0; column < width; column++)
                {
                    char blockElement = this.lines[row][column];
                    this.blocks[column, row] = LoadBlock(blockElement, column * GRIDWIDTH, row * GRIDHEIGHT);
                }
            }
            BeetleManager.Level = this;
            ScorpionManager.Level = this;
            ExplorerManager.Level = this;
        }
Beispiel #2
0
        private void loadAssets()
        {
            this.lines = new List<string>();
            this.treasures = new List<Image>();
            this.scorpionList = new List<Scorpion>();
            this.beetleList = new List<Beetle>();
               // MovingBlockManager.CollisionGridDown();
              //  MovingBlockManager.CollisionGridUp();
              //  this.movingBlocks = new List<MovingBlock>();
            this.panel = new Panel(this.game, new Vector2(0, 448));
            StreamReader reader = new StreamReader(this.levelPath);
            string line = reader.ReadLine();
            int width = line.Length;

            while(line != null)
            {
                lines.Add(line);
                line = reader.ReadLine();
            }

            int height = lines.Count;
            this.tiles = new Tile[width, height];
            reader.Close();
            for (int row = 0; row < height; row++)
            {
                for (int column = 0; column < width; column++)
                {
                    char blockElement = this.lines[row][column];
                    this.tiles[column, row] = loadTile(blockElement, column * GRIDWIDTH, row * GRIDHEIGHT);
                }
            }
            BeetleManager.Level = this;
            ScorpionManager.Level = this;
            ExplorerManager.Level = this;
            ExplorerManager.Explorer = this.explorer;
        }