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); } }
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); }
public static void Resu(Monster[] monster) { if (Keyboard.GetState().IsKeyDown(Keys.U)) { foreach (Monster m in monster) { m.S_Resu(); } } }
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; }
public Projectile(ContentManager Content, Monster target, Personnage caster, Vector2 position, int damage) { willExplodeAnd_DESTROY_THE_FACE_OF_DA_MONSSSTTTTTEEEEEERRRRRRRRRRRRRRRRRR = false; GOOOOOOOOOO = false; imageState = 0; objet = Content.Load<Texture2D>("magic/fireball" + imageState); this.position = new Vector2(position.X + 40, position.Y + 30); this.target = target; this.caster = caster; this.damage = damage; this.time = 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); } }
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(); }
public static bool G_EndLevel(Monster[] monster) { bool mobAlive = false; try { foreach (Monster m in monster) { if (m.G_IsAlive()) { mobAlive = true; } } } catch (NullReferenceException) { } return ((-screenPos.X >= MaxX - Program.width && Keyboard.GetState().IsKeyDown(Keys.Enter) && !mobAlive) || (Keyboard.GetState().IsKeyDown(Keys.Enter) && Keyboard.GetState().IsKeyDown(Keys.F1))); }
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); } } }
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(); }
public static Monster[] LoadMonster(Monster[] monster) { if (GameState.Level == 1) { monster[0] = new Monster(new Vector2(1220f, 400f), 1, 1); monster[1] = new Monster(new Vector2(1600f, 300f), 1, 1); monster[2] = new Monster(new Vector2(2000f, 350f), 1, 1); monster[3] = new Monster(new Vector2(2500f, 300f), 1, 1); monster[4] = new Monster(new Vector2(2600f, 400f), 1, 1); monster[5] = new Monster(new Vector2(3500f, 350f), 1, 2); } if (GameState.Level == 2) { monster[0] = new Monster(new Vector2(1220f, 400f), 2, 1); monster[1] = new Monster(new Vector2(1300f, 500f), 2, 1); monster[2] = new Monster(new Vector2(1500f, 350f), 2, 1); monster[3] = new Monster(new Vector2(1800f, 300f), 2, 1); monster[4] = new Monster(new Vector2(2000f, 400f), 2, 1); monster[5] = new Monster(new Vector2(2500f, 350f), 2, 2); } if (GameState.Level == 3) { monster[0] = new Monster(new Vector2(1220f, 400f), 3, 1); monster[1] = new Monster(new Vector2(1300f, 500f), 3, 1); monster[2] = new Monster(new Vector2(1500f, 350f), 3, 1); monster[3] = new Monster(new Vector2(1800f, 300f), 3, 1); monster[4] = new Monster(new Vector2(2000f, 400f), 3, 1); monster[5] = new Monster(new Vector2(2500f, 350f), 3, 2); } if (GameState.Level == 4) { monster[0] = new Monster(new Vector2(1220f, 400f), 1, 1); monster[1] = new Monster(new Vector2(1300f, 500f), 1, 1); monster[2] = new Monster(new Vector2(1500f, 350f), 1, 1); monster[3] = new Monster(new Vector2(1800f, 300f), 1, 1); monster[4] = new Monster(new Vector2(2000f, 400f), 1, 1); monster[5] = new Monster(new Vector2(2500f, 350f), 1, 2); } if (GameState.Level == 5) { monster[0] = new Monster(new Vector2(1220f, 400f), 1, 1); monster[1] = new Monster(new Vector2(1300f, 500f), 1, 1); monster[2] = new Monster(new Vector2(1500f, 350f), 1, 1); monster[3] = new Monster(new Vector2(1800f, 300f), 1, 1); monster[4] = new Monster(new Vector2(2000f, 400f), 1, 1); monster[5] = new Monster(new Vector2(2500f, 350f), 1, 2); } return monster; }
private void F_Update(Personnage[] perso, Monster[] monster, ContentManager Content, GameTime gameTime, GraphicsDeviceManager graphics) { if (G_IsAlive()) { F_Deplacer(); F_Cheat(gameTime, perso); if (newState.IsKeyDown(Keys.LeftShift)) { S_ImgState(20); } F_Attaque(monster, gameTime, Content, perso); F_SpecialAttaque(monster, perso, gameTime); foreach (Rectangle collision in Map.G_Collision()) { F_Collision_Objets(collision, gameTime); } foreach (Monster m in monster) { if (m.G_IsAlive()) F_Collision_Objets(m.G_Rectangle(), gameTime); } for (int i = 0; i < projectile.Count; i++) { if (projectile[i].Update(gameTime, Content)) { projectile.RemoveAt(i); } } F_Collision_Ecran(graphics, gameTime); F_UpdateRegen(gameTime); } F_UpdateImage(gameTime); try { objet = Content.Load<Texture2D>("perso/" + classe + "/" + imgState); } catch (ContentLoadException) { } S_Deplacement(gameTime); }
private void F_SpecialAttaque(Monster[] monster, Personnage[] perso, GameTime gameTime) { switch (classe) { case 1: F_Booster(gameTime); break; case 2: F_BERZERKER(gameTime); break; case 3: F_Healing(perso, gameTime); break; case 4: F_OverKill(monster, perso, gameTime); break; } }
private void F_OverKill(Monster[] monster, Personnage[] perso, GameTime gameTime) { newState = Keyboard.GetState(); Monster[] m_target_ovrkl = new Monster[GameState.Monster]; Personnage[] p_target_ovrkl = new Personnage[GameState.Player]; bool p_target = false; bool m_target = false; tempsActuel = (float)gameTime.TotalGameTime.TotalSeconds; if (tempsActuel > tempsAttaque[1] + 3) { if (newState.IsKeyDown(key[5]) && power >= 500) { power -= 500; for (int i = 0; i < GameState.Monster; i++) { m_target_ovrkl[i] = null; } for (int i = 0; i < GameState.Player; i++) { p_target_ovrkl[i] = null; } for (int i = 0; i < GameState.Monster; i++) { m_target_ovrkl[i] = F_DetectMonsters(monster[i]); foreach (Monster m in m_target_ovrkl) { if (m != null) m_target = true; } if (m_target && monster[i].G_IsAlive() && m_target_ovrkl[i] != null) { monster[i].S_Degat((int)((10 + level * 7) * mana), gameTime); if (monster[i].G_Killed()) { S_Xp(monster[i].G_MaxLife(), gameTime, perso); } } } for (int i = 0; i < GameState.Player; i++) { if (i != id - 1) { p_target_ovrkl[i] = F_DetectAllies(perso[i]); foreach (Personnage p in p_target_ovrkl) { if (p != null) p_target = true; } if (p_target && perso[i].G_IsAlive() && p_target_ovrkl[i] != null) { perso[i].S_Degat((int)((level * 3) * mana), gameTime); } } } Son.Play(4); imgState = 101; tempsAttaque[1] = tempsActuel; } } else { if (tempsActuel > tempsAttaque[1] + 1) if (imgState == 105) imgState = 20; else { } else if (tempsActuel > tempsAttaque[1] + 0.8) imgState = 105; else if (tempsActuel > tempsAttaque[1] + 0.6) imgState = 104; else if (tempsActuel > tempsAttaque[1] + 0.4) imgState = 103; else if (tempsActuel > tempsAttaque[1] + 0.2) imgState = 102; if (imgState > 100) speed = Vector2.Zero; } }
private Monster F_DetectMonsters(Monster m) { Monster m_ = null; if (m.G_Aggro().Intersects(G_Rectangle())) m_ = m; return m_; }
private void F_Attaque(Monster[] monster, GameTime gameTime, ContentManager Content, Personnage[] perso) { newState = Keyboard.GetState(); tempsActuel = (float)gameTime.TotalGameTime.TotalSeconds; if (tempsActuel > tempsAttaque[0] + time) { if (newState.IsKeyDown(key[4]) && (classe == 1 || (classe == 2 && AtkSpe) || power >= 100)) { oldImage = imgState; bool attaque = false; if (classe == 1 || (classe == 2 && AtkSpe)) { } else power -= 100; foreach (Monster m in monster) { if (m.G_IsAlive() && !attaque && ((G_Rectangle().Intersects(m.G_Aggro()) && classe == 4) || (G_Rectangle().Intersects(m.G_Interact()) && classe != 4))) { attaque = true; if (classe == 4) { projectile.Add(new Projectile(Content, m, this, position, (int)((42 + random.Next(10) + 10 * level) * force))); } else { m.S_Degat((int)((42 + random.Next(10) + 10 * level) * force), gameTime); if (m.G_Killed()) { S_Xp(m.G_MaxLife() / 4, gameTime, perso); } } } } if (id == 3) Son.Play(3); tempsAttaque[0] = tempsActuel; } } else if (classe == 1 && !AtkSpe) { if (tempsActuel > tempsAttaque[0] + 0.35) { if (imgState % 10 == -3) { Son.Play(1); imgState = oldImage / 10 * 10; } } else if (tempsActuel > tempsAttaque[0] + 0.25) { ImageTest(-3); } else if (tempsActuel > tempsAttaque[0] + 0.16) { ImageTest(-2); } else if (tempsActuel > tempsAttaque[0] + 0.07) { ImageTest(-1); } else if (tempsActuel > tempsAttaque[0]) { ImageTest(0); } } else if (classe == 1 && AtkSpe) { if (tempsActuel > tempsAttaque[0] + 0.175) { if (imgState % 10 == -3) { Son.Play(1); imgState = oldImage / 10 * 10; } } else if (tempsActuel > tempsAttaque[0] + 0.125) { ImageTest(-3); } else if (tempsActuel > tempsAttaque[0] + 0.08) { ImageTest(-2); } else if (tempsActuel > tempsAttaque[0] + 0.035) { ImageTest(-1); } else if (tempsActuel > tempsAttaque[0]) { ImageTest(0); } } else if (classe == 2 && !AtkSpe) { if (tempsActuel > tempsAttaque[0] + 0.3) { if (imgState % 10 == -2) { Son.Play(1); imgState = oldImage / 10 * 10; } } else if (tempsActuel > tempsAttaque[0] + 0.2) { ImageTest(-2); } else if (tempsActuel > tempsAttaque[0] + 0.1) { ImageTest(-1); } else if (tempsActuel > tempsAttaque[0]) { ImageTest(0); } } else if (classe == 2 && AtkSpe) { if (tempsActuel > tempsAttaque[0] + 0.3 - (0.3 * 1/6)) { if (imgState % 10 == -2) { Son.Play(1); imgState = oldImage / 10 * 10; } } else if (tempsActuel > tempsAttaque[0] + 0.2 - (0.2 * 1/6)) { ImageTest(-2); } else if (tempsActuel > tempsAttaque[0] + 0.1 - (0.1 * 1/6)) { ImageTest(-1); } else if (tempsActuel > tempsAttaque[0]) { ImageTest(0); } } else if (classe == 3) { if (tempsActuel > tempsAttaque[0] + 0.4) { if (imgState < 0) { imgState = oldImage / 10 * 10; Son.Play(3); } } else { if (oldImage / 10 == 1 || oldImage / 10 == 2 || oldImage / 10 == 3 || oldImage / 10 == 5 || oldImage / 10 == 6) imgState = -10; else imgState = -20; } } else if (classe == 4) { if (tempsActuel > tempsAttaque[0] + 0.8) { if (imgState % 10 == -3) { imgState = oldImage / 10 * 10; } } else if (tempsActuel > tempsAttaque[0] + 0.6) { for (int i = 0; i < projectile.Count; i++) { projectile[i].StartFiring(); } ImageTest(-3); } else if (tempsActuel > tempsAttaque[0] + 0.4) { ImageTest(-2); } else if (tempsActuel > tempsAttaque[0] + 0.2) { ImageTest(-1); } else if (tempsActuel > tempsAttaque[0]) { ImageTest(0); } } if (imgState < 0) speed = Vector2.Zero; }
public static void Update(Personnage[] perso, GameTime gameTime, Monster[] monster, GraphicsDeviceManager graphics, ContentManager Content) { foreach (Personnage p in perso) p.F_Update(perso, monster, Content, gameTime, graphics); }
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; }
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); }
public static void Load(Monster[] monster, ContentManager Content) { foreach (Monster m in monster) m.F_Init(Content); }
public static void Update(Monster[] monster, GameTime gameTime, Personnage[] perso, ContentManager Content) { foreach (Monster m in monster) m.F_Update(gameTime, perso, Content); }