Example #1
0
 public override void UnloadContent()
 {
     base.UnloadContent();
     player.UnloadContent();
     tilesandenemies.UnloadContent();
     ScoreManager.Instance.ResetValues();
     BulletHandler.Instance.ResetValues();
     SoundManager.Instance.UnloadContent();
     player = null;
     tilesandenemies = null;
 }
Example #2
0
        public void Update(GameTime gameTime, Player player)
        {
            //deathtile2d.X = 0;
            //deathtile2d.Y = 0;
            if(state == "Solid")//Below is the collision handling
            {
                Rectangle tileRect = new Rectangle((int)Position.X, (int)Position.Y,
                    sourceRect.Width, sourceRect.Height);

                if(Collision.RectRect(tileRect, player.GetCurrentRect()))
                {
                    player.DyinginTiles = true;
                    //deathtile2d.X = playerrect.X;
                    //deathtile2d.Y = playerrect.Y;
                }
            }
            //return the point of collisionplayer vs tile
        }
Example #3
0
 void LoadTilesandEnemies()
 {
     player = new Player(playerparameters);
        /* foreach (Loader.parameter v in loadedparams.Loadedparamaters)
     {
         try
         {
             map1.Parameterdictionary.Add(v.type, v);
         }
         catch (ArgumentException)
         {
             Console.WriteLine("An element with Key = \"v.type\" already exists.");
         }
     }*/
 }
Example #4
0
        /// <summary>
        /// Map updates the layershere and checks for collsions via collision manager
        /// </summary>
        /// <param name="gameTime"></param>
        public void Update(GameTime gameTime, Player player)
        {
            //Check for collsiions between enemy and plyer and playerbullets
            CollisionManager.Instance.checkEnemyPlayerBulletCollision(maplistenemies);
            CollisionManager.Instance.CheckPlayEnemyBulletCollsion();
            bool cleanup = false;
            foreach (layer l in Layer)
                l.Update(gameTime, player);

            foreach (EnemyGadget eg in maplistenemies)
            {
                if (!eg.Dying)
                {
                    eg.Update(gameTime);
                }
                else
                {
                    cleanup = true;
                    //Collided load animated graphics
                    BulletHandler.Instance.addAnimatedGraphics((int)eg.DeathVector.X,
                        (int)eg.DeathVector.Y);
                    SoundManager.Instance.Playexplode();
                }
            }
            //if the was somethign dying then remove it from the list
            if (cleanup)
                maplistenemies.RemoveAll(EnemyGadget => EnemyGadget.Dying);

            BulletHandler.Instance.update(gameTime);//used to be in player

            foreach (GameGadgets gg in maplistgamegadgets)
            {
                gg.Update(gameTime);
            }
        }