Exemple #1
0
        public Level(SpriteBatch spritebatch, Texture2D[] tileTextures, byte[,] tileArray, Texture2D enemyTexture, Vector2[] enemyPositions, Texture2D trapTexture, Vector2[] trapPositions, int levelNr)
        {
            OrangeTileTexture = tileTextures[0];
            GreenTileTexture  = tileTextures[1];
            SpriteBatch       = spritebatch;
            TileArray         = tileArray;
            EnemyTexture      = enemyTexture;
            EnemyPositions    = enemyPositions;
            TrapTexture       = trapTexture;
            TrapPositions     = trapPositions;
            LevelNr           = levelNr;

            Blokken = new Blok[Columns, Rows];

            Enemies.Add(Enemy1);
            Enemies.Add(Enemy2);
            Traps.Add(Trap1);

            TrapAnimation  = new ObjectAnimation(TrapTexture, SpriteBatch, TrapPositions[0], 120, 400, 6, 60, Color.WhiteSmoke, .7f, true, 1, new int[] { 0, 0, 0, 0, 0, 0 }, 0);
            TrapAnimation2 = new ObjectAnimation(TrapTexture, SpriteBatch, TrapPositions[1], 120, 400, 6, 60, Color.WhiteSmoke, .7f, true, 1, new int[] { 0, 0, 0, 0, 0, 0 }, 0);
            TrapAnimation3 = new ObjectAnimation(TrapTexture, SpriteBatch, TrapPositions[2], 120, 400, 6, 60, Color.WhiteSmoke, .7f, true, 1, new int[] { 0, 0, 0, 0, 0, 0 }, 0);

            CreateLevel();

            CurrentBoard = this;

            if (levelNr == 2)                // kan zonder levelNr als je traps en enemies meegeeft met Level Object
            {
                Traps.Clear();               //clear enemies en traps van vorige level voor je nieuwe level start
                Enemies.Clear();
                Enemies.Add(Enemy1);
                Enemies.Add(Enemy2);
                CreateLevel2();
            }
        }
Exemple #2
0
 //  ===== End Collision logic =====
 //  ===== Start Enemy / trap logic =====
 private void CreateEnemies()
 {
     for (int i = 0; i < Enemies.Count; i++)
     {
         EnemyAnimation = new ObjectAnimation(EnemyTexture, SpriteBatch, EnemyPositions[i], 70, 65, 8, 200, Color.WhiteSmoke, 1.4f, true, 2, new int[] { 0, 20, 20, 0 }, 0);
         Enemies[i]     = new Enemy(EnemyAnimation, EnemyPositions[i], SpriteBatch);
     }
 }
Exemple #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            _orangeTileTexture   = Content.Load <Texture2D>("Brick_Block1");
            _greenTileTexture    = Content.Load <Texture2D>("groen2");
            _heroTexture         = Content.Load <Texture2D>("kiri4");
            _enemyTexture        = Content.Load <Texture2D>("enemy2");
            _flamesTexture       = Content.Load <Texture2D>("flames4");
            _menuBackground      = Content.Load <Texture2D>("bk1");
            _endScreenBackground = Content.Load <Texture2D>("end");
            _finishTexture       = Content.Load <Texture2D>("finish2");
            _backTexture         = Content.Load <Texture2D>("BK3");
            _backTexture2        = Content.Load <Texture2D>("BK2");
            _coinTexture         = Content.Load <Texture2D>("Coin");
            _coinScoreTexture    = Content.Load <Texture2D>("CoinScore");
            _asunaTexture        = Content.Load <Texture2D>("Asuna2");
            _asunaTexture2       = Content.Load <Texture2D>("Asuna3");

            _titleFont       = Content.Load <SpriteFont>("menuTitle");
            _descriptionFont = Content.Load <SpriteFont>("Description");
            _debugFont       = Content.Load <SpriteFont>("DebugFont2");

            _menuFonts = new SpriteFont[] { _titleFont, _descriptionFont };
            _menu      = new Menu(_menuFonts, _menuBackground, _spriteBatch);

            _soundEffect = Content.Load <SoundEffect>("coinCollect1");

            _themeSong = Content.Load <Song>("SAO3_Administrator");
            MediaPlayer.Play(_themeSong);
            MediaPlayer.IsRepeating        = true;
            MediaPlayer.MediaStateChanged += MediaPlayer_MediaStateChanged;

            _finish = new Finish(_finishTexture, _spriteBatch, new Vector2(6250, 450), 1);
            _asuna1 = new Finish(_asunaTexture, _spriteBatch, new Vector2(6280, 475), 1.7f);
            _asuna2 = new Finish(_asunaTexture2, _spriteBatch, new Vector2(6280, 475), 1.7f);

            _coinAnimation6 = new ObjectAnimation(_coinTexture, _spriteBatch, new Vector2(2880, 540), 130, 150, 6, 90, Color.WhiteSmoke, .5f, true, 1, new int[] { 0, 0, 0, 0 }, 0);
            _coinAnimation5 = new ObjectAnimation(_coinTexture, _spriteBatch, new Vector2(1800, 600), 130, 150, 6, 90, Color.WhiteSmoke, .5f, true, 1, new int[] { 0, 0, 0, 0 }, 0);
            _coinAnimation4 = new ObjectAnimation(_coinTexture, _spriteBatch, new Vector2(1500, 600), 130, 150, 6, 90, Color.WhiteSmoke, .5f, true, 1, new int[] { 0, 0, 0, 0 }, 0);
            _coinAnimation  = new ObjectAnimation(_coinTexture, _spriteBatch, new Vector2(1411, 165), 130, 150, 6, 90, Color.WhiteSmoke, .5f, true, 1, new int[] { 0, 0, 0, 0 }, 0);
            _coinAnimation2 = new ObjectAnimation(_coinTexture, _spriteBatch, new Vector2(845, 290), 130, 150, 6, 90, Color.WhiteSmoke, .5f, true, 1, new int[] { 0, 0, 0, 0 }, 0);
            _coinAnimation3 = new ObjectAnimation(_coinTexture, _spriteBatch, new Vector2(250, 480), 130, 150, 6, 90, Color.WhiteSmoke, .5f, true, 1, new int[] { 0, 0, 0, 0 }, 0);

            _heroAnimation = new ObjectAnimation(_heroTexture, _spriteBatch, new Vector2(70, 100), 40, 65, 4, 90, Color.WhiteSmoke, 1.4f, true, 4, new int[] { 0, 0, 0, 0 }, 0);
            _hero          = new Hero(_heroAnimation, new Vector2(70, 100), _spriteBatch);

            _blokkenVoorLevel  = new Texture2D[] { _orangeTileTexture, _greenTileTexture };
            _enemyPositonsLvl1 = new Vector2[] { new Vector2(1400, 550), new Vector2(2800, 160) };
            _enemyPositonsLvl2 = new Vector2[] { new Vector2(900, 550), new Vector2(4450, 550) };
            _trapPositons      = new Vector2[] { new Vector2(5500, 400), new Vector2(700, 400), new Vector2(5750, 400) };

            _level1 = new Level(_spriteBatch, _blokkenVoorLevel, _tileArrayLvl1, _enemyTexture, _enemyPositonsLvl1, _flamesTexture, _trapPositons, 1);

            CreateCoins();
        }
Exemple #4
0
 private void CreateTrapsLvl1()
 {
     for (int i = 0; i < Traps.Count; i++)
     {
         TrapAnimation = new ObjectAnimation(TrapTexture, SpriteBatch, TrapPositions[i], 120, 400, 6, 60, Color.WhiteSmoke, .7f, true, 1, new int[] { 0, 0, 0, 0, 0, 0 }, 0);
         Traps[i]      = new Trap(TrapAnimation, TrapPositions[i], SpriteBatch);
     }
     //Trap1Lvl1 = new Trap(trapAnimation2, TrapPositions[0], SpriteBatch);
     //traps.Add(Trap1Lvl1);
 }