Beispiel #1
0
        /// <summary>
        /// Instantiates an enemy and puts him in the level.
        /// </summary>
        private Tile LoadEnemyTile(int x, int y, string spriteSet)
        {
            Vector2 position = RectangleExtensions.GetBottomCenter(GetBounds(x, y));

            enemies.Add(new Enemy(this, position, spriteSet));

            return(new Tile(null, TileCollision.Passable));
        }
Beispiel #2
0
        /// <summary>
        /// Instantiates a player, puts him in the level, and remembers where to put him when he is resurrected.
        /// </summary>
        private Tile LoadStartTile(int x, int y)
        {
            if (Player != null)
            {
                throw new NotSupportedException("A level may only have one starting point.");
            }

            start  = RectangleExtensions.GetBottomCenter(GetBounds(x, y));
            player = new Player(this, start);

            return(new Tile(null, TileCollision.Passable));
        }