Beispiel #1
0
 /// <summary>
 /// Default colliding tile constructor
 /// </summary>
 /// <param name="positionInGrid"></param>
 internal LevelTile(LevelGrid grid, Point positionInGrid, int tileSize) : base(Vector2.Zero, 0, 0)
 {
     this.grid      = grid;
     Pos            = positionInGrid;
     collides       = true;
     OnIntersect   += _default;
     centerPosition = new Vector2(Pos.X * tileSize + tileSize / 2, Pos.Y * tileSize + tileSize / 2);
     Initialize(tileSize);
 }
Beispiel #2
0
        /// <summary>
        /// creates the level object, it handles everything, from updating the collision, to drawing to the screen.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="player"></param>
        internal Level(string path, ref Player player)
        {
            #region Initial Setup
            this.player = player;
            AddEntity(player);

            grid = new LevelGrid(this, 32, 32, path);

            quadTree = new Quadtree(0, new Rectangle(0, 0, grid.totalWidth, grid.totalHeight));
            bounds   = new Rectangle(0, 0, grid.totalWidth, grid.totalHeight);
            GenerateWallBounds();
            #endregion
        }