Ejemplo n.º 1
0
        public override void LoadContent(ContentManager Content, GraphicsDevice graph, ref string level, ref string next, GraphicsDeviceManager graphics)
        {
            width = graphics.PreferredBackBufferWidth;
            height = graphics.PreferredBackBufferHeight;
            _pause.initbutton(ref level);
            //background
            backgroundT = Content.Load<Texture2D>("level1//fond_niv1");
            //sprite brouillon
            alllenT = Content.Load<Texture2D>("hero//fiches_sprite_allen");
              //  alllenT = Content.Load<Texture2D>("yoh3");
            //platfom
            platform_t = Content.Load<Texture2D>("level1//platform");
            //ia
            aster = Content.Load<Texture2D>("IA//asteroid//asteroide-sprite");
            naruto_stalker = Content.Load<Texture2D>("IA//naruto");
            eve = Content.Load<Texture2D>("IA//eve");
            truc_jaune = Content.Load<Texture2D>("IA//tuc_jaune");

            //background
            scrolling1 = new Scrolling_H(backgroundT, new Rectangle(0, 0, width, height), back_sc);
            //sprite brouillon
            allen = new sprite_broillon(alllenT , new Rectangle(width / 2, 0, 125, 93), collision, Content,'1');
            //instanciement du manager d ia
            platform_M = new Platform_manager(platform_t, width * 0.1f, height * 0.1f, front_sc, height, width);
            //intenciement des 3 ia
            managerAA = new IA_manager_AA(truc_jaune, new Rectangle(0, 0, 100, 100), front_sc, 3, height, width);
            managerAR = new IA_manager_AR(eve, new Rectangle(0, 0, 100, 100), front_sc, 4, height, width);
            manageS = new IA_manager_S(naruto_stalker, new Rectangle(0, 0, 100, 100), front_sc, 3, height, width);
            //instancie les donnees de la pause
            _pause.LoadContent(Content);

                // ajout ia aller retour (X,Y)
                managerAR.Add(1.1f, 0);
               /*     managerAR.Add(0.5f, 0.5f);
                managerAR.Add(2.1f, 0.5f);
                managerAR.Add(-0.5f, 0f);
                managerAR.Add(2.1f, 0.45f);
                managerAR.Add(2.4f, 0.55f);
                managerAR.Add(3.2f, 0.7f);
                managerAR.Add(3.6f, 0.7f);
              */  // ajout IA qui vont tous droit(X,Y)
                managerAA.Add(1.11f, 0);
                managerAA.Add(0.54f, 0.5f);
                managerAA.Add(2.14f, 0.5f);
                managerAA.Add(-0.58f, 0f);
                managerAA.Add(2.3f, 0.45f);
                managerAA.Add(2.6f, 0.45f);
                managerAA.Add(3.2f, 0.7f);
                // ajout des ia Stalker (X,Y)
                manageS.Add(1.15f, 0);
                manageS.Add(2f, 0.7f);
                manageS.Add(2.1f, 0.45f);
                manageS.Add(3.2f, 0.7f);

            // ajout platform (position X,position Y, nombre de plateforme juxtaposer)
            platform_M.Add(0.4f, 0.8f, 9);
            platform_M.Add(1f, 0.7f, 9);
            platform_M.Add(1.86f, 0.9f, 10);
            platform_M.Add(-0.76f, 0.6f, 10);
            platform_M.Add(1.9f,0.6f,5);
            platform_M.Add(2.6f, 0.6f, 2);
            platform_M.Add(2.4f, 0.7f, 1);
            platform_M.Add(2.9f, 0.8f, 1);
            platform_M.Add(3f, 0.9f, 1);
            platform_M.Add(3.2f, 0.9f, 6);
            platform_M.Add(3.1f, 1f, 1);
        }
Ejemplo n.º 2
0
 // a finir
 public void h_M2P(ref IA_manager_AA AA, ref IA_manager_AR AR, ref IA_manager_K K, ref sripte_V pl1, ref sripte_V pl2)
 {
     for (int i = 0; i < AA.bulletL.Count; ++i)
     {
         if (AA.bulletL[i].rectangle_C.Intersects(pl1.rectangle_C))
         {
             pl1.vie -= AA.bulletL[i].degat;
             AA.bulletL.RemoveAt(i);
         }
         else if (AA.bulletL[i].rectangle_C.Intersects(pl2.rectangle_C))
         {
             pl2.vie -= AA.bulletL[i].degat;
             AA.bulletL.RemoveAt(i);
         }
     }
     for (int i = 0; i < AR.bulletL.Count; ++i)
     {
         if (AR.bulletL[i].rectangle_C.Intersects(pl1.rectangle_C))
         {
             pl1.vie -= AR.bulletL[i].degat;
             AR.bulletL.RemoveAt(i);
         }
         else if (AR.bulletL[i].rectangle_C.Intersects(pl2.rectangle_C))
         {
             pl2.vie -= AR.bulletL[i].degat;
             AR.bulletL.RemoveAt(i);
         }
     }
     for (int i = 0; i < AA.Ia_manage.Count; ++i)
     {
         for (int j = 0; j < pl1.bulletL.Count; ++j)
         {
             if (pl1.bulletL[j].rectangle_C.Intersects(AA.Ia_manage[i].rectangle_C))
                 AA.Ia_manage[i].vie -= pl1.bulletL[i].degat;
         }
         for (int j = 0; j < pl2.bulletL.Count; ++j)
         {
             if (pl2.bulletL[j].rectangle_C.Intersects(AA.Ia_manage[i].rectangle_C))
                 AA.Ia_manage[i].vie -= pl2.bulletL[i].degat;
         }
         if (AA.Ia_manage[i].rectangle_C.Intersects(pl1.rectangle_C))
         {
             pl1.vie -= 30;
             AA.Ia_manage.RemoveAt(i);
         }
         else if (AA.Ia_manage[i].rectangle_C.Intersects(pl2.rectangle_C))
         {
             pl2.vie -= 30;
             AA.Ia_manage.RemoveAt(i);
         }
     }
     for (int i = 0; i < AR.Ia_manage.Count; ++i)
     {
         for (int j = 0; j < pl1.bulletL.Count; ++j)
         {
             if (pl1.bulletL[j].rectangle_C.Intersects(AR.Ia_manage[i].rectangle_C))
                 AR.Ia_manage[i].vie -= pl1.bulletL[i].degat;
         }
         for (int j = 0; j < pl2.bulletL.Count; ++j)
         {
             if (pl2.bulletL[j].rectangle_C.Intersects(AR.Ia_manage[i].rectangle_C))
                 AR.Ia_manage[i].vie -= pl2.bulletL[i].degat;
         }
         if (AR.Ia_manage[i].rectangle_C.Intersects(pl1.rectangle_C))
         {
             pl1.vie -= 30;
             AR.Ia_manage.RemoveAt(i);
         }
         else if (AR.Ia_manage[i].rectangle_C.Intersects(pl2.rectangle_C))
         {
             pl2.vie -= 30;
             AR.Ia_manage.RemoveAt(i);
         }
     }
     for (int i = 0; i < K.Ia_manage.Count; ++i)
     {
         for (int j = 0; j < pl1.bulletL.Count; ++j)
         {
             if (pl1.bulletL[j].rectangle_C.Intersects(K.Ia_manage[i].rectangle_C))
                 K.Ia_manage[i].vie -= pl1.bulletL[i].degat;
         }
         for (int j = 0; j < pl2.bulletL.Count; ++j)
         {
             if (pl2.bulletL[j].rectangle_C.Intersects(K.Ia_manage[i].rectangle_C))
                 K.Ia_manage[i].vie -= pl2.bulletL[i].degat;
         }
         if (K.Ia_manage[i].rectangle_C.Intersects(pl1.rectangle_C))
         {
             pl1.vie -= K.Ia_manage[i].damage;
             AA.Ia_manage.RemoveAt(i);
         }
         else if (K.Ia_manage[i].rectangle_C.Intersects(pl2.rectangle_C))
         {
             pl2.vie -= K.Ia_manage[i].damage;
             K.Ia_manage.RemoveAt(i);
         }
     }
 }