Exemplo n.º 1
0
        public void Update(sprite_broillon  sprite,KeyboardState keyboard)
        {
            // condition de proximiter
            switch (type)
            {
                case '1':
                    if (touched())
                        current = walk;
                    else
                    {

                    }
                    break;
                default:
                    break;
            }
            Update_rec_collision();
            AnimeSPrite();
        }
Exemplo n.º 2
0
        public void testAudio(sprite_broillon sprite, SoundEffect song)
        {
            if ((sprite.jump_ok) && ((Keyboard.GetState().IsKeyDown(Keys.Right) || Keyboard.GetState().IsKeyDown(Keys.Left))))

                song.Play();
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        // saut non fini
        public void jump(sprite_broillon sprite)
        {
            int i = 10;
            if (sprite.rectangle.Y >= sprite.pos_marche - sprite.impulse)
            {
                sprite.rectangle.Y -= (i + sprite.poid);
                sprite.jump_off = true;

            }
            if (sprite.rectangle.Y == sprite.pos_marche - sprite.impulse)
            {
                sprite.jump_off = false;

            }
        }
Exemplo n.º 5
0
        //collision IA allen action vie--
        public void coll_AL_IA(IA_Manager_max ia_manage, ref sprite_broillon sprite)
        {
            for (int i = 0; i < ia_manage.Ia_manage.Count; ++i)
            {
                if (ia_manage.Ia_manage[i].rectangle_C.Bottom > sprite.rectangle_C.Top && sprite.rectangle_C.Bottom > ia_manage.Ia_manage[i].rectangle_C.Top)
                {// attaque vers droite
                    if (!sprite.atq)
                    {
                        if ((ia_manage.Ia_manage[i].dir == 1 &&
                            ia_manage.Ia_manage[i].rectangle_C.Right + ia_manage.Ia_manage[i].longueur_Attaque >= sprite.rectangle_C.Left &&
                            ia_manage.Ia_manage[i].rectangle_C.Right < sprite.rectangle_C.Left) ||
                            (ia_manage.Ia_manage[i].dir == -1 &&
                            ia_manage.Ia_manage[i].rectangle_C.Left - ia_manage.Ia_manage[i].longueur_Attaque <= sprite.rectangle_C.Right &&
                            ia_manage.Ia_manage[i].rectangle_C.Left > sprite.rectangle_C.Right))
                        {
                            sprite.vie--;
                            //bool pr dire qd on attaque
                            ia_manage.Ia_manage[i].attaque = true;
                        }
                        // attaque vers la gauche-
                        else
                            ia_manage.Ia_manage[i].attaque = false;
                    }
                    else
                    {
                        if (!sprite._dir && ia_manage.Ia_manage[i].rectangle_C.Left - sprite.longattaque < sprite.rectangle_C.Right &&
                             ia_manage.Ia_manage[i].rectangle_C.Left > sprite.rectangle_C.Right)
                        {
                            --ia_manage.Ia_manage[i].vie;
                        }
                        else if (sprite._dir &&
                          ia_manage.Ia_manage[i].rectangle_C.Right + sprite.longattaque >= sprite.rectangle_C.Left &&
                                        ia_manage.Ia_manage[i].rectangle_C.Right < sprite.rectangle_C.Left)
                        {
                            --ia_manage.Ia_manage[i].vie;
                        }

                    }
                }
                else
                    ia_manage.Ia_manage[i].attaque = false;
            }
        }
Exemplo n.º 6
0
        // collision sprite sol fini
        public bool Collision_sp_sol(ref sprite_broillon sprite, ref Platform_manager platform_m)
        {
            foreach (platform plato in platform_m.plato)
                if (sprite.rectangle_C.Bottom >= plato.rectangle_C.Top && sprite.rectangle_C.Right >= plato.rectangle_C.Left &&
                    sprite.rectangle_C.Left <= plato.rectangle_C.Right && sprite.rectangle_C.Bottom - 9 <= plato.rectangle_C.Top)
                {

                    sprite.rectangle.Y = plato.rectangle_C.Top - sprite.decalageY - sprite.rectangle_C.Height;

                    return true;
                }
            return false;
        }
Exemplo n.º 7
0
 protected void fail(Game1 game, sprite_broillon sprite, Game1.gameState _currentState)
 {
     if (sprite.rectangle.Bottom > 2 * height||sprite.dead )
         game.ChangeState(Game1.gameState.Pause, _currentState);
 }