Esempio n. 1
0
 /// <summary>
 /// Creates the level.
 /// All the different kind of bloks will be generated and loaded (textures and position)
 /// </summary>
 /// <param name="content"></param>
 public void CreateLevel(ContentManager content)
 {
     for (int i = 0; i < tileArray.GetLength(0); i++)
     {
         for (int j = 0; j < tileArray.GetLength(1); j++)
         {
             if (tileArray[i, j] == 1)
             {
                 blokArray[i, j]    = new Blok(content.Load <Texture2D>("png/Tile/5"), new Vector2(128 * i, 128 * j));
                 blokArray[i, j].Id = 1;
             }
             else if (tileArray[i, j] == 2)
             {
                 blokArray[i, j]    = new Blok(content.Load <Texture2D>("png/Tile/2"), new Vector2(128 * i, 128 * j));
                 blokArray[i, j].Id = 1;
             }
             else if (tileArray[i, j] == 3)
             {
                 blokArray[i, j]    = new Blok(content.Load <Texture2D>("png/water"), new Vector2(128 * i, 128 * j));
                 blokArray[i, j].Id = 3;
             }
             else if (tileArray[i, j] == 4)
             {
                 blokArray[i, j]    = new Blok(content.Load <Texture2D>("png/water_bottom"), new Vector2(128 * i, 128 * j));
                 blokArray[i, j].Id = 4;
             }
             else if (tileArray[i, j] == 25)
             {
                 blokArray[i, j]    = new Blok(content.Load <Texture2D>("Objects/Sign"), new Vector2(128 * i, 128 * j + 50));
                 blokArray[i, j].Id = 25;
             }
             else
             {
                 blokArray[i, j] = null;
             }
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Constructor for the class.
        /// Initializes and creates enemies, which type of tile is used where and starts the collision for both hero and enemies alike.
        /// </summary>
        /// <param name="_content"></param>
        /// <param name="myHero"></param>
        public Level2(ContentManager _content, Hero myHero)
        {
            enemies = new List <Enemies>();
            CreateEnemies(_content);
            tileArray = new byte[, ]
            {
                { 2, 1, 1, 1, 1, 1, 1, 1 },
                { 0, 0, 2, 0, 0, 0, 2, 1 },
                { 0, 0, 2, 0, 0, 0, 2, 1 },
                { 0, 0, 2, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 2, 1, 1, 1, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 2, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 2, 1, 1, 1 },
                { 0, 0, 0, 0, 2, 1, 1, 1 },
                { 0, 0, 0, 2, 1, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 2, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 2, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 2, 0, 0, 0, 2, 1 },
                { 0, 0, 2, 0, 0, 0, 2, 1 },
                { 0, 0, 2, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 2, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 2, 0, 0, 0, 2, 1 },
                { 0, 0, 2, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 2, 1, 1, 1, 1 },
                { 0, 0, 0, 2, 1, 1, 1, 1 },
                { 0, 0, 2, 1, 1, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 2, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 2, 0, 0, 2 },
                { 0, 0, 0, 0, 2, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 2, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 2, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 2, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 2, 1, 0, 0, 0, 2 },
                { 0, 0, 2, 0, 0, 0, 0, 2 },
                { 0, 0, 2, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 2, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 2, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 2, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 2, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 2, 0, 2, 1 },
                { 0, 0, 0, 0, 2, 0, 0, 2 },
                { 0, 0, 0, 0, 2, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 2, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 0, 2, 1, 1, 1 },
                { 0, 0, 0, 2, 1, 1, 1, 1 },
                { 0, 0, 2, 1, 1, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 25, 2, 1 },
                { 2, 1, 1, 1, 1, 1, 1, 1 },
            };

            blokArray             = new Blok[tileArray.GetLength(0), tileArray.GetLength(1)];
            heroCollisionChecker  = new HeroCollisionWithEnemies(myHero, blokArray, enemies);
            enemyCollisionChecker = new EnemyCollision(blokArray, enemies);
        }
Esempio n. 3
0
        /// <summary>
        /// Constructor for the class.
        /// Initializes and creates enemies, which type of tile is used where and starts the collision for the hero.
        /// </summary>
        /// <param name="_content"></param>
        /// <param name="myHero"></param>
        public BeginnerLevel1(ContentManager _content, Hero myHero)
        {
            tileArray = new byte[, ]
            {
                { 2, 1, 1, 1, 1, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 0, 2, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 0, 2, 1, 1, 1 },
                { 0, 0, 0, 0, 2, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 2, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 2, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 0, 2, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 2, 0, 0, 0, 2, 1 },
                { 0, 0, 2, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 2, 1, 1, 1, 1 },
                { 0, 0, 0, 2, 1, 1, 1, 1 },
                { 0, 0, 2, 1, 1, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 2, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 2, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 2, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 2, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 2, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 2, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 2, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 2, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 2, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 0, 0, 3, 1 },
                { 0, 0, 0, 0, 2, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 2, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 2, 0, 2, 1 },
                { 0, 0, 0, 2, 1, 0, 2, 1 },
                { 0, 0, 2, 1, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 0, 2 },
                { 0, 2, 0, 0, 0, 0, 0, 2 },
                { 0, 0, 0, 0, 2, 0, 0, 2 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 2, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 2, 1, 1, 1 },
                { 0, 0, 0, 2, 1, 1, 1, 1 },
                { 0, 0, 2, 1, 1, 1, 1, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 0, 2, 1 },
                { 0, 0, 0, 0, 0, 25, 2, 1 },
                { 2, 1, 1, 1, 1, 1, 1, 1 },
            };

            blokArray            = new Blok[tileArray.GetLength(0), tileArray.GetLength(1)];
            heroCollisionChecker = new HeroCollision(myHero, blokArray);
        }