Example #1
0
        /// <summary>
        /// Instantiates an activeHero, puts him in the level, and remembers where to put him when he is resurrected.
        /// </summary>
        private void LoadHero()
        {
            if (ActiveHero != null)
            {
                throw new NotSupportedException("A level may only have one starting point.");
            }

            //where the player starts in the map
            start = RectangleExtensions.GetBottomCenter(GetBounds((int)map.StartTile.X, (int)map.StartTile.Y));

            Heroes[0] = new HeroStrength(this, new Vector2(-1, -1));
            Heroes[1] = new HeroSpeed(this, new Vector2(-1, -1));
            Heroes[2] = new HeroFlight(this, new Vector2(-1, -1));

            activeHero          = (Hero)Heroes[1];
            activeHero.Position = start;
        }
Example #2
0
        /// <summary>
        /// Instantiates an enemy and puts him in the level.
        /// </summary>
        public void SpawnEnemy(int x, int y, string enemyType)
        {
            Vector2 position = RectangleExtensions.GetBottomCenter(GetTileAtPoint(x, y));

            enemies.Add(EnemyFactory.NewEnemy(this, position, enemyType));
        }