Exemplo n.º 1
0
        public Map(Map_Stuff.MapBuilderInterface mbiLoad, PictureBox[,] DisplayForTiles, ImageList TexturesForTiles)
        {
            //Get the right map size.
            intMapHeight = mbiLoad.GetHeight();
            intMapWidth  = mbiLoad.GetWidth();
            mtiGameMap   = new MapTileInterface[intMapWidth, intMapHeight];

            //Make each tile in the map the right type.
            String[,] Layout = mbiLoad.GetMapLayout();
            for (int i = 0; i < intMapWidth; i++)
            {
                for (int j = 0; j < intMapHeight; j++)
                {
                    mtiGameMap[i, j] = new MapTile(Layout[i, j], DisplayForTiles[i, j], TexturesForTiles);
                }
            }

            //Make our starting tile vissable
            MakeTileVissable(mbiLoad.GetStartingLocation());
        }
Exemplo n.º 2
0
        public frmGameWindow(Map_Stuff.MapBuilderInterface GameMap)
        {
            InitializeComponent();

            //Build the game display, a 2dimensional array the same size as the game map
            PictureBox[,] GameDisplay = new PictureBox[GameMap.GetWidth(), GameMap.GetHeight()];

            for (int i = 0; i < GameDisplay.GetLength(0); i++)
            {
                for (int j = 0; j < GameDisplay.GetLength(1); j++)
                {
                    GameDisplay[i, j]          = new PictureBox();
                    GameDisplay[i, j].Location = new Point(i * 40, j * 40);
                    GameDisplay[i, j].Size     = new Size(40, 40);

                    this.Controls.Add(GameDisplay[i, j]);
                }
            }

            CurrentTerrain = new Simple_Game.Map(GameMap, GameDisplay, imglstTileImages);
        }