示例#1
0
 // main window
 public Form1()
 {
     Location levelformaat = new Location(10, 10);
     Location startpunt = new Location(1, 1);
     Location eindpunt = new Location(10, 10);
     int tilesize = 32;
     map = new Level(levelformaat,startpunt,eindpunt,tilesize);
     speler = new Player(map.Start,tilesize);
     InitializeComponent();
 }
示例#2
0
 public bool Compareto(Location second)
 {
     if(this.X==second.X && this.Y == second.Y)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
示例#3
0
        private Tile[][] tiles; //Array of all the tiles in the game

        #endregion Fields

        #region Constructors

        public Level(Location gridsize, Location s, Location e,int size=32)
        {
            //Setup of the gridsize
            gridSize = new Location(gridsize.X + 2, gridsize.Y + 2); //gridsize wordt vergroot met twee voor muren
            //horizontal rows are initialized
            tiles = new Tile[gridSize.X][];
            for (int y = 0; y < gridSize.X; y++)
            {
                //vertical cells are initialized
                tiles[y] = new Tile[gridSize.Y];
            }

            //initiate start and end point
            start = s;
            eind = e;

            //setting up the floorplan
            for (int xloc = 0; xloc < gridSize.X; xloc++)
            {
                for (int yloc = 0; yloc < gridSize.Y; yloc++)
                {
                    tiles[xloc][yloc] = new Tile(new Location(xloc, yloc),size); //assign all tiles and turn them into floors
                    if (yloc == 0 || yloc == gridSize.Y - 1 || xloc == 0 || xloc == gridSize.X - 1)
                    {
                        tiles[xloc][yloc].Type = new Tiletype(1);   //assign the outer walls
                    }
                    //Place start location
                    if (tiles[xloc][yloc].Pos.Compareto(start))
                    {
                        tiles[xloc][yloc].Type.Type = 2;
                    }
                    //Place end location
                    if (tiles[xloc][yloc].Pos.Compareto(eind))
                    {
                        tiles[xloc][yloc].Type.Type = 3;
                    }
                }
            }
        }
示例#4
0
 public Player(Location init,int s =32)
 {
     pos = init;
     size = s;
 }
示例#5
0
        private Tiletype tiletype; //opslaan van het type tegel

        #endregion Fields

        #region Constructors

        public Tile(Location init,int size=32,int tile = 0)
        {
            pos = init; //pos waarde geven
            tiletype = new Tiletype(tile); //type aangeven, standaard is vloer
            tilesize = size; // default = 32 pixels
        }