Exemple #1
0
 public static void Update(PNJ[] pnj, Personnage[] perso, GameTime gameTime, GraphicsDeviceManager graphics, ContentManager Content)
 {
     foreach (PNJ p in pnj)
     {
         p.F_Update(perso, gameTime);
     }
 }
Exemple #2
0
 public static void Draw(PNJ[] pnj, SpriteBatch spriteBatch)
 {
     foreach (PNJ p in pnj)
     {
         p.F_Draw(spriteBatch);
     }
 }
Exemple #3
0
 public static void Load(PNJ[] pnj, ContentManager Content)
 {
     foreach (PNJ p in pnj)
     {
         p.F_Load(Content);
     }
 }
Exemple #4
0
 public static void Update(GameTime gameTime, GraphicsDeviceManager graphics, ContentManager Content, Personnage[] perso, Monster[] monster, PNJ[] pnj)
 {
     if (continuer)
     {
         continuer = Menu.Update(monster, perso, pnj, graphics, gameTime, Content);
     }
 }
Exemple #5
0
 public static void LoadNewMap(GameTime gameTime, ContentManager Content, GraphicsDeviceManager graphics, SpriteBatch sb, ref Personnage[] perso, ref Monster[] monster, ref PNJ[] pnj, ref int nbMonster)
 {
     pnj = new PNJ[Map.InitPNJ()];
     perso = new Personnage[GameState.Player];
     nbMonster = Map.Init(monster, pnj);
     monster = new Monster[nbMonster];
     monster = Map.LoadMonster(monster);
     LoadingMenu.Load(perso, monster, pnj, Content, gameTime);
 }
Exemple #6
0
 public static bool Update(GameTime gameTime, ContentManager Content, GraphicsDeviceManager graphics, SpriteBatch sb, ref Personnage[] perso, ref Monster[] monster, ref PNJ[] pnj, ref int nbPlayer, ref int nbMonster)
 {
     nbPlayer = LoadingMenu.Update(perso, Content);
     if (nbPlayer != 0)
     {
         perso = new Personnage[nbPlayer];
         LoadNewMap(gameTime, Content, graphics, sb, ref perso, ref monster, ref pnj, ref nbMonster);
         return true;
     }
     return false;
 }
Exemple #7
0
        public static void Draw(Personnage[] perso, Monster[] monster, PNJ[] pnj, SpriteBatch sb, GraphicsDeviceManager graphics, GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.Pink);
            sb.Begin(SpriteBlendMode.AlphaBlend);

            try
            {
                Map.DrawBack(sb);
                Map.DrawMiddle(sb);
                if (!Map.G_FirstHide())
                {
                    Map.DrawFirst(sb);
                }
                Mob.Draw(perso, monster, pnj, sb, gameTime);
                if (Map.G_FirstHide())
                {
                    Map.DrawFirst(sb);
                }
                Map.DrawBossTrigger(sb, gameTime);
                if (pause)
                {
                    menuObject[0].Draw(sb);
                    Color color = Color.DarkKhaki;
                    if (currentCursor == 0)
                    {
                        color = Color.Gold;
                    }
                    sb.DrawString(GameState.menuFont, LoadingMenu.Local[13], new Vector2(350, 350), color);
                    if (currentCursor == 1)
                    {
                        color = Color.Gold;
                    }
                    else
                    {
                        color = Color.DarkKhaki;
                    }
                    sb.DrawString(GameState.menuFont, LoadingMenu.Local[14], new Vector2(350, 475), color);
                    if (currentCursor == 2)
                    {
                        color = Color.Gold;
                    }
                    else
                    {
                        color = Color.DarkKhaki;
                    }
                    sb.DrawString(GameState.menuFont, LoadingMenu.Local[2], new Vector2(350, 600), color);
                }
            }
            catch (ArgumentNullException) { }

            sb.End();
        }
Exemple #8
0
        public static void Draw(Personnage[] perso, Monster[] monster, PNJ[] pnj, SpriteBatch sb, GameTime gameTime)
        {
            Vector2[] sort = new Vector2[GameState.Player + GameState.Monster];
            for (int k = 0; k < GameState.Player; k++)
            {
                sort[k].X = k;
                sort[k].Y = perso[k].position.Y + 65;
                if (! perso[k].G_IsAlive())
                    sort[k].Y -= 4242;
            }
            for (int k = 0; k < GameState.Monster; k++)
            {
                sort[k + GameState.Player].X = k + GameState.Player;
                sort[k + GameState.Player].Y = monster[k].position.Y + 155;
                if (!monster[k].G_IsAlive())
                    sort[k + GameState.Player].Y -= 4242;
            }

            for (int i = 0; i < GameState.Player + GameState.Monster; i++)
            {
                int min = -1;
                for (int k = 0; k < GameState.Player + GameState.Monster; k++)
                {
                    if ((sort[k].X != -1) && (min == -1 || sort[k].Y < sort[min].Y))
                    {
                        min = k;
                    }
                }
                array[i] = (int)sort[min].X;
                sort[min].X = -1;
            }

            foreach (int i in array)
            {
                if (i < GameState.Player)
                    perso[i].F_Draw(sb, gameTime, perso);
                else
                    monster[i - GameState.Player].F_Draw(sb);
            }

            PNJ.Draw(pnj, sb);

            foreach (Monster m in monster)
            {
                m.F_DrawDegats(sb, gameTime);
            }

            foreach (Personnage p in perso)
            {
                p.F_DrawDegats(sb, gameTime);
            }
        }
Exemple #9
0
 public static void Draw(GameTime gameTime, SpriteBatch spriteBatch, GraphicsDeviceManager graphics, ContentManager Content, Personnage[] perso, Monster[] monster, PNJ[] pnj)
 {
     if (continuer)
     {
         Menu.Draw(perso, monster, pnj, spriteBatch, graphics, gameTime);
     }
     else
     {
         if (!Keyboard.GetState().IsKeyDown(Keys.Enter))
         {
             Menu.DrawGameOver(perso, monster, pnj, spriteBatch, graphics, gameTime);
         }
         else
         {
             GameState.Restart(Content);
         }
     }
 }
Exemple #10
0
        public static void DrawGameOver(Personnage[] perso, Monster[] monster, PNJ[] pnj, SpriteBatch spriteBatch, GraphicsDeviceManager graphics, GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.Pink);
            spriteBatch.Begin(SpriteBlendMode.AlphaBlend);

            try
            {
                Map.DrawBack(spriteBatch);
                Map.DrawMiddle(spriteBatch);
                if (!Map.G_FirstHide())
                {
                    Map.DrawFirst(spriteBatch);
                }
                Mob.Draw(perso, monster, pnj, spriteBatch, gameTime);
                if (Map.G_FirstHide())
                {
                    Map.DrawFirst(spriteBatch);
                }
            }
            catch (ArgumentNullException) { }
            menuObject[1].Draw(spriteBatch);

            spriteBatch.End();
        }
Exemple #11
0
 public bool G_Interact(PNJ pnj)
 {
     return G_Rectangle().Intersects(pnj.G_Interact());
 }
Exemple #12
0
        public static bool Update(Monster[] monster, Personnage[] perso, PNJ[] pnj, GraphicsDeviceManager graphics, GameTime gameTime, ContentManager Content)
        {
            if (pause)
            {
                UpdatePause(Content);
            }
            else
            {
                newState = Keyboard.GetState();
                Monster.Update(monster, gameTime, perso, Content);
                Personnage.Update(perso, gameTime, monster, graphics, Content);
                PNJ.Update(pnj, perso, gameTime, graphics, Content);
                Monster.Resu(monster);
                if (!Map.Update(gameTime, perso, Content))
                    return false;

                pause = (newState.IsKeyDown(Keys.Escape) && !oldState.IsKeyDown(Keys.Escape));
                oldState = newState;
            }
            return GameOver(perso, Content);
        }
 public static void Load(Personnage[] perso, Monster[] monster, PNJ[] pnj, ContentManager Content, GameTime gameTime)
 {
     Mob.Load(Content);
     SaveLoad.LoadClass(ref persoClasse, perso);
     Personnage.Load(perso, Content);
     SaveLoad.LoadPerso(perso);
     Monster.Load(monster, Content);
     PNJ.Load(pnj, Content);
     Map.Load(Content);
     Map.Update(gameTime, perso, Content);
 }
Exemple #14
0
        public static int Init(Monster[] monster, PNJ[] pnj)
        {
            first = new Texture2D[3];
            middle = new Texture2D[3];
            back = new Texture2D[3];

            if (GameState.Level == 1)
            {
                MaxX = 4 * 1024;
                collision = new Rectangle[2];
                collision[0] = new Rectangle(0, 320, MaxX, PIXEL);
                collision[1] = new Rectangle(0, 768, MaxX, PIXEL);

                originBack = new Vector2(0f, 0f);
                originMiddle = new Vector2(0f, -320f);
                originFirst = new Vector2(0f, -704f);
                speedBack = 5;
                speedMiddle = 1;
                speedFirst = 1;
                firstHide = true;
                parallax = true;

                pnj[0] = new PNJ(new Vector2(600, 600), 42, LoadingMenu.Local[15]);
                pnj[1] = new PNJ(new Vector2(3900, 500), 42, LoadingMenu.Local[16]);
                Son.InstanceStop();
                if (Program.musique)
                {
                    Son.InitLoopSound(5);
                    Son.InstancePlay();
                }

                return 6;
            }
            else if (GameState.Level == 2)
            {
                MaxX = 4 * 1024;
                collision = new Rectangle[2];
                collision[0] = new Rectangle(0, 288, MaxX, PIXEL);
                collision[1] = new Rectangle(0, 800, MaxX, PIXEL);

                originBack = new Vector2(0f, 0f);
                originMiddle = new Vector2(0f, -224f);
                originFirst = new Vector2(0f, -320f);
                speedBack = 1;
                speedMiddle = 1;
                speedFirst = 1;
                firstHide = false;
                parallax = false;

                pnj[0] = new PNJ(new Vector2(2876, 500), 42, LoadingMenu.Local[17]);

                return 6;
            }
            else if (GameState.Level == 3)
            {
                MaxX = 4 * 1024;
                collision = new Rectangle[2];
                collision[0] = new Rectangle(0, 96, MaxX, PIXEL);
                collision[1] = new Rectangle(0, 704, MaxX, PIXEL);

                originBack = new Vector2(0f, 0f);
                originMiddle = new Vector2(0f, -128f);
                originFirst = new Vector2(0f, -640f);
                speedBack = 1;
                speedMiddle = 1;
                speedFirst = 1;
                firstHide = true;
                parallax = false;

                return 6;
            }
            else if (GameState.Level == 4)
            {
                MaxX = 4 * 1024;
                collision = new Rectangle[2];
                collision[0] = new Rectangle(0, 128, MaxX, PIXEL);
                collision[1] = new Rectangle(0, 736, MaxX, PIXEL);

                originBack = new Vector2(0f, 0f);
                originMiddle = new Vector2(0f, -160f);
                originFirst = new Vector2(0f, -672f);
                speedBack = 1;
                speedMiddle = 1;
                speedFirst = 1;
                firstHide = true;
                parallax = false;

                return 6;
            }
            else if (GameState.Level == 5)
            {
                MaxX = 5 * 1024;
                collision = new Rectangle[2];
                collision[0] = new Rectangle(0, 128, MaxX, PIXEL);
                collision[1] = new Rectangle(0, 768, MaxX, PIXEL);

                originBack = new Vector2(0f, 0f);
                originMiddle = new Vector2(0f, -160f);
                originFirst = new Vector2(0f, -736f);
                speedBack = 1;
                speedMiddle = 1;
                speedFirst = 1;
                firstHide = true;
                parallax = false;

                return 6;
            }
            return 0;
        }