Exemplo n.º 1
0
 //collision IA missile action ia.vie --
 public void collision_ai_missile(ref sripte_V sprite, IA_Manager_max iamanage)
 {
     for (int i = 0; i < sprite.bulletL.Count; ++i)
         foreach (vaisseau_IA ai in iamanage.Ia_manage)
             if (sprite.bulletL[i].rectangle_C.Intersects(ai.rectangle_C))
             {
                 ai.vie -= sprite.bulletL[i].degat;
                 sprite.bulletL.RemoveAt(i);
             }
 }
Exemplo n.º 2
0
 // collision objet missible
 public bool Collision_as_mis(objet aster, sripte_V sprite)
 {
     for (int i = 0; i < sprite.bulletL.Count; ++i)
         if (aster.rectangle_C.Intersects(sprite.bulletL[i].rectangle_C))
         {
             sprite.bulletL.RemoveAt(i);
             sprite.bulletL[i].existe = false;
             return true;
         }
     return false;
 }
Exemplo n.º 3
0
        public void Bullet_Update(KeyboardState keyboard, sripte_V sprite, KeyboardState oldkey, Vector2 vise, int nb, ref List<munition> bullet,ref int sizeX,ref int sizeY,ref int timer)
        {
            if (timer != time1)
                time1 = timer;
            if (keyboard.IsKeyDown(Keys.Space) && oldkey.IsKeyDown(Keys.Space) && tem2 <= 0 && enableFire) //autorisation de tire
            {

                tem2 = time1;
                switch (nb)
                {
                    case 1:
                        bullet.Add(
                            new munition( new Rectangle(sprite.rectangle_C.Center.X  - sizeX/2, sprite.rectangle_C.Center.Y , sizeX, sizeY), speed, vise, colo));
                        break;
                    case 2:
                        bullet.Add(
                    new munition( new Rectangle(sprite.rectangle_C.Left - sizeX/2 , sprite.rectangle_C.Center.Y , sizeX, sizeY), speed, vise, colo));
                        bullet.Add(
                    new munition( new Rectangle(sprite.rectangle_C.Right -sizeX/2 , sprite.rectangle_C.Center.Y, sizeX, sizeY), speed, vise, colo));
                        break;
                    case 3:
                        bullet.Add(
                    new munition( new Rectangle(sprite.rectangle_C.Center.X -sizeX/2 , sprite.rectangle_C.Center.Y ,  sizeX, sizeY), speed, vise, colo));
                        bullet.Add(
                    new munition( new Rectangle(sprite.rectangle_C.Left - sizeX / 2, sprite.rectangle_C.Center.Y, sizeX, sizeY), speed, new Vector2(1f, 1f), colo));
                        bullet.Add(
                    new munition( new Rectangle(sprite.rectangle_C.Right - sizeX / 2, sprite.rectangle_C.Center.Y, sizeX, sizeY), speed, new Vector2(-1f, 1f), colo));
                        break;
                    default:
                        bullet.Add(
                     new munition( new Rectangle(sprite.rectangle_C.Left - sizeX / 2, sprite.rectangle_C.Center.Y, sizeX, sizeY), speed, vise, colo));
                        bullet.Add(
                    new munition( new Rectangle(sprite.rectangle_C.Right - sizeX / 2, sprite.rectangle_C.Center.Y, sizeX, sizeY), speed, vise, colo));
                     bullet.Add(
                         new munition( new Rectangle(sprite.rectangle_C.Left - sizeX / 2, sprite.rectangle_C.Center.Y, sizeX, sizeY), speed, new Vector2(1f, 1f), colo));
                        bullet.Add(
                    new munition( new Rectangle(sprite.rectangle_C.Right - sizeX / 2, sprite.rectangle_C.Center.Y, sizeX, sizeY), speed, new Vector2(-1f, 1f), colo));

                          break;
                }
                soundeffect.Play(); //lance un son lors du tire

            }
            tem2--;
            //update che chaque missile
            for (int i = 0; i < bullet.Count; i++)
            {
                bullet[i].update2();
                if (bullet[i].rectangle.Top < 0)
                    bullet.RemoveAt(i);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///jeu level perso chargement
        /// </summary>
        /// <param name="level">nom du niveau</param>
        /// <param name="iamanage_K">manager de ia</param>
        /// <param name="iamanage_T"></param>
        /// <param name="iamanage_V"></param>
        public void load_leveleditor_SEU(ContentManager Content, string level, ref IA_manager_K iamanage_K,
            ref IA_manager_T iamanage_T, ref IA_manager_V iamanage_V, ref Scrolling_ManagerV scrollM, ref GraphicsDevice grap, ref sripte_V sprite, ref Ovni ovni)
        {
            savefile savefile = new savefile();
            load_SEU(ref level, ref savefile);
            for (int j = 0; j < savefile.ia_tireur.Count; ++j)
                iamanage_T.Add(savefile.ia_tireur[j]);
            for (int j = 0; j < savefile.ia_viseur.Count; ++j)
                iamanage_V.Add(savefile.ia_viseur[j]);
            for (int j = 0; j < savefile.ia_Kamikaze.Count; ++j)
                iamanage_K.Add(savefile.ia_Kamikaze[j]);
            for (int j = 0; j < savefile.bonus.Count; ++j)
                ovni.Add(savefile.bonus[j]);

            scrollM.Load(Content, savefile.levelProfile, grap);
            sprite.parametrage(ref savefile.levelProfile);
            ovni.param(savefile.levelProfile.fc_speed);
        }
Exemplo n.º 5
0
 public void Update(ref sripte_V sprite, ref int gametime)
 {
     for (int i = 0; i < ia_manage.Count; ++i)
     {
         if (ia_manage[i]. timer_lunch <= gametime)
         {
             ia_manage[i].Update_rec_collision();
             if (ia_manage[i].rectangle_C.Center.X > sprite.rectangle_C.Center.X + 9)
                 ia_manage[i].rectangle.X -= ia_manage[i].Speed ;
             else
                 ia_manage[i].rectangle.X += ia_manage[i].Speed ;
             if (ia_manage[i].rectangle_C.Center.Y > sprite.rectangle_C.Center.Y + 9)
                 ia_manage[i].rectangle.Y -= ia_manage[i].Speed;
             else
                 ia_manage[i].rectangle.Y += ia_manage[i].Speed;
         }
         remove(ref i);
     }
 }
Exemplo n.º 6
0
        public void Update(ref sripte_V sprite, ref int gameTime)
        {
            //update che chaque missile
            for (int i = 0; i < bulletL.Count; i++)
            {
                bulletL[i].update2();
                if (bulletL[i].rectangle_C.Top > 1080)
                    bulletL.RemoveAt(i);
            }
            for (int i = 0; i < ia_manage.Count; ++i)
            {
                if (ia_manage[i].timer_lunch <= gameTime)
                {
                    ia_manage[i].bullet.Bullet_Update2(this . ia_manage[i], vise(sprite, ref ia_manage[i].rectangle_C ), 1, ref bulletL);
                    ia_manage[i].Update_rec_collision();
                    moveH(ref i);
                }

                this.ia_manage[i].Timer++;
                if (this.ia_manage[i].Timer == this.AnimationSpeed)
                {
                    this.ia_manage[i].Timer = 0;
                    this.ia_manage[i].FrameColunm++;
                    if (ia_manage[i].FrameLine == 1 && ia_manage[i].FrameColunm > 5)
                    {
                        ia_manage[i].FrameColunm = 1;
                        ia_manage[i].FrameLine = 2;
                    }
                    else if (ia_manage[i].FrameLine == 2 && ia_manage[i].FrameColunm > 8)
                    {
                        ia_manage[i].FrameColunm = 1;
                        ia_manage[i].FrameLine = 1;
                    }

                    remove(ref i);
                }
            }
        }
Exemplo n.º 7
0
        public override void LoadContent(ContentManager Content, GraphicsDevice graph, ref string level, ref string next, GraphicsDeviceManager graphics)
        {
            //charge le fond
            //    bacgkround1 = Content.Load<Texture2D>("level2//fond");
            //  background2 = Content.Load<Texture2D>("level2//fond2");
            //charge le sprite
            fond = new Rectangle(400, 0, width/2, height);
            Scroll = new Scrolling_ManagerV(fond);
            T_sprite = Content.Load<Texture2D>("hero//spriteSheet");

            //charge l IA
            aster_t = Content.Load<Texture2D>("spritesheet");
            planet1 = Content.Load<Texture2D>("IA/asteroid/planet4");
            star = Content.Load<Texture2D>("IA/asteroid/star");

            //instancie le scolling

            //  scrolling1 = new Scrolling(bacgkround1, new Rectangle(0, 0, width, height), 2, height,0.01f);

            //  scrolling2 = new Scrolling(background2, new Rectangle(0, 0, width, height), 3, height,1f);

            //intancie le vaisseau
            vaisseau = new sripte_V(
                new Rectangle(height / 2 + taille_sprt / 2, width / 2 + taille_sprt / 2, sizeX , sizey ),  height, width);

            //instancie l ia
            //     aster = new asteroid(aster_t, new Rectangle(100, 75, taille_sprt, taille_sprt), 0.01f, width, height);
            manage_T = new IA_manager_T(planet1, new Rectangle(0, 0, taille_sprt, taille_sprt), Content,fond);
            manage_V = new IA_manager_V(star, new Rectangle(0, 0, taille_sprt, taille_sprt), Content,fond);
            manage_k = new IA_manager_K(aster_t, new Rectangle(0, 0, taille_sprt, taille_sprt),fond);
            ovini = new Ovni(width, height);
            ovini.Load(aster_t);
            // ajout IA
            save.load_leveleditor_SEU(Content, level, ref manage_k, ref manage_T, ref manage_V, ref Scroll, ref graph,ref vaisseau , ref ovini  );
            vaisseau.Load(Content, T_sprite);
            //instancie les donnees de la pause
            _pause.LoadContent(Content);
        }
Exemplo n.º 8
0
        public override void LoadContent(ContentManager Content, GraphicsDevice graph, ref string level, ref string next, GraphicsDeviceManager graphics)
        {
            width = graphics.PreferredBackBufferWidth;
            height = graphics.PreferredBackBufferHeight;

             ovini = new Ovni(width, height);
            taille_sprt = (int)(Math.Min(width, height) * 0.05);
            taille_sprt2 = (int)(Math.Min(width, height) * 0.08);
            //charge le fond
            //         background1 = Content.Load<Texture2D>("level2//fond");
            //       background2 = Content.Load<Texture2D>("back//fond2");
            //charge le sprite
            _pause.initbutton(ref level);
            T_sprite = Content.Load<Texture2D>("hero//spriteSheet");
            fond =new  Rectangle(width/4 , 0, width / 2, height);
            scroll = new Scrolling_ManagerV(fond );
            //charge l IA
            aster_t = Content.Load<Texture2D>("IA/asteroid/asteroide-sprite");
            planet1 = Content.Load<Texture2D>("IA/asteroid/planet4");
            star = Content.Load<Texture2D>("IA/asteroid/star");

            //instancie le scolling

            //   scrolling1 = new Scrolling(bacgkround1, new Rectangle(0, 0, width, height), 2, height,1f);

            //    scrolling2 = new Scrolling(background2, new Rectangle(0, 0, width, height), 3, height,0.5f);

            //intancie le vaisseau
            vaisseau = new sripte_V(
                new Rectangle(height / 2 + taille_sprt / 2, width / 2 + taille_sprt / 2, taille_sprt2, taille_sprt2), height, width);

            //instancie l ia

            manage_T = new IA_manager_T(planet1, new Rectangle(0, 0, taille_sprt2, taille_sprt2), Content, fond);
            manage_V = new IA_manager_V(star, new Rectangle(0, 0, taille_sprt, taille_sprt), Content, fond);
            manage_k = new IA_manager_K(aster_t, new Rectangle(0, 0, taille_sprt, taille_sprt),fond);
            //instancie les donnees de la pause
            _pause.LoadContent(Content);
               ovini.Load(aster_t);

            // ajout IA

            save.load_level_SEU(Content,ref level,ref next , ref manage_k, ref manage_T, ref manage_V, ref scroll, ref graph, ref vaisseau,ref ovini );
            vaisseau.Load(Content, T_sprite);
        }
Exemplo n.º 9
0
        public override void LoadContent(ContentManager Content, GraphicsDevice graph, ref string level, ref string next, GraphicsDeviceManager graphics)
        {
            _pause.initbutton(ref level);
            Scroll_manager = new Scrolling_ManagerV(new Rectangle(0,0,width,height ));
            //charge le fond
            //  bacgkround1 = Content.Load<Texture2D>(backGround);
            //charge le sprite
            T_sprite = Content.Load<Texture2D>("hero//spriteSheet");

            //charge l IA

            aster_t = Content.Load<Texture2D>("IA/asteroid/asteroide-sprite");
            planet1 = Content.Load<Texture2D>("IA/asteroid/planet4");
            star = Content.Load<Texture2D>("IA/asteroid/star");
            //instancie le scolling

            manage_T = new IA_manager_T(planet1, new Rectangle(0, 0, taille_sprt, taille_sprt), Content, height, width);
            manage_V = new IA_manager_V(star, new Rectangle(0, 0, taille_sprt, taille_sprt), Content, height, width);
            manage_k = new IA_manager_K(aster_t, new Rectangle(0, 0, taille_sprt, taille_sprt), height, width);

            //intancie le vaisseau
            vaisseau = new sripte_V(
                new Rectangle(height / 2 + taille_sprt / 2, width / 2 + taille_sprt / 2, taille_sprt, taille_sprt), height, width);
            vaisseau.Load(Content, T_sprite);
            ovni = new Ovni(width, height);
            ovni.param(3);
            ovni.Load(aster_t);

            //instancie les donnees de la pause
            _pause.LoadContent(Content);
            user.LoadContent(manage_T, manage_V, manage_k, Scroll_manager, Content, ovni);
        }
Exemplo n.º 10
0
 public void Ovni_vaiss(ref Ovni ovnis, ref sripte_V sprite)
 {
     for (int i = 0; i < ovnis.ovni.Count; ++i)
     {
         if (ovnis.ovni[i].circle.is_in_bound(sprite.rectangle_C))
         {
             sprite.vie += ovnis.ovni[i].vie;
             sprite.vie -= ovnis.ovni[i].damage;
             sprite.power += ovnis.ovni[i].power;
             sprite.bomb += ovnis.ovni[i].bomb;
             ovnis.ovni.RemoveAt(i);
         }
     }
 }
Exemplo n.º 11
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);
         }
     }
 }
Exemplo n.º 12
0
 // collision hero avec missille ou ia avetion game over
 public void hero_missile(IA_Manager_max ia_manage, ref sripte_V sprite)
 {
     for (int i = 0; i < ia_manage.bulletL.Count; ++i)
         if (ia_manage.bulletL[i].rectangle_C.Intersects(sprite.rectangle_C))
         {
             sprite.vie -= ia_manage.bulletL[i].degat;
             ia_manage.bulletL.RemoveAt(i);
         }
 }
Exemplo n.º 13
0
 //collision IA hero action: vie--
 public void col_H_IA(IA_Manager_max ia_manage, ref sripte_V sprite)
 {
     foreach (vaisseau_IA ia in ia_manage.Ia_manage)
         if (ia.rectangle_C.Intersects(sprite.rectangle_C))
         {
             ia.vie = -30;
             sprite.vie -= 30;
         }
 }
Exemplo n.º 14
0
        /// <summary>
        ///  jeu normal chargement
        /// </summary>
        /// <param name="Content"></param>
        /// <param name="level">nom du nivau</param>
        /// <param name="iamanage_K"></param>
        /// <param name="iamanage_T"></param>
        /// <param name="iamanage_V"></param>
        public void load_level_SEU(ContentManager Content, ref string level, ref string next, ref IA_manager_K iamanage_K,
            ref IA_manager_T iamanage_T, ref IA_manager_V iamanage_V, ref Scrolling_ManagerV scrollM, ref GraphicsDevice grash, ref sripte_V sprite, ref Ovni ovni)
        {
            savefile savefil = new savefile();
            FileStream file1 = null;
            XmlSerializer f = null;

            DirectoryInfo dir = null;
            dir = new DirectoryInfo(Content.RootDirectory + "\\" + level);
            if (dir.Exists)
            {
                file1 = new FileStream(dir.FullName + "\\level.lvl", FileMode.Open, FileAccess.Read);
                f = new XmlSerializer(typeof(savefile));
                savefil = (savefile)f.Deserialize(file1);
                file1.Close();
            }
            for (int j = 0; j < savefil.ia_tireur.Count; ++j)
                iamanage_T.Add(savefil.ia_tireur[j]);
            for (int j = 0; j < savefil.ia_viseur.Count; ++j)
                iamanage_V.Add(savefil.ia_viseur[j]);
            for (int j = 0; j < savefil.ia_Kamikaze.Count; ++j)
                iamanage_K.Add(savefil.ia_Kamikaze[j]);
            for (int j = 0; j < savefil.bonus.Count; ++j)
                ovni.Add(savefil.bonus[j]);
            scrollM.Load(Content, savefil.levelProfile, grash);
            sprite.parametrage(ref savefil.levelProfile);
            ovni.param(savefil.levelProfile.fc_speed);
            next = savefil.levelProfile.next_level;
        }