// main public Personnage(int taille_image_x, int taille_image_y, int nb_frameLine, int nb__framecolumn, int frame_start, int animation_speed, Vector2 position , Texture2D image, gamemain game) { main = game; this.position = position; this.animaitonspeed = animation_speed; true_hitbox_motherfucker = new Rectangle(Hitbox.Width, Hitbox.Height, 20, 10); timer = 0; Framecolumn = 2; FrameLine = 1; Speed = 2; this.nb_Framecolumn = nb__framecolumn; this.nb_Frameline = nb_frameLine; this.Image = image; this.Taille_image_x = taille_image_x; this.Taille_image_y = taille_image_y; this.Frame_start = frame_start; }
public NPC(int taille_image_x, int taille_image_y, int nb_frameLine, int nb__framecolumn, int frame_start, int animation_speed, Vector2 position, Texture2D image, GamePlayer player, gamemain main) : base(taille_image_x, taille_image_y, nb_frameLine, nb__framecolumn, frame_start, animation_speed, position, image, main) { this.player = player; Pv = 100; }
public Chargement(GamePlayer player, switch_map mapi, Personnage pos, gamemain main) { this.Mapi = mapi; this.Main = main; this.Player = player; Position = pos; fichier = new FileStream(@"save/Save.txt", FileMode.Open, FileAccess.Read); load = new BinaryReader(fichier); }
public potion(Texture2D texture, GamePlayer player, gamemain main, NPC npc, string name) : base(texture, player, npc.Position, main) { Main = main; Player = player; Texture = texture; Hitbox_potion = new Rectangle((int)Position.X, (int)Position.Y, Texture.Bounds.Width, Texture.Bounds.Y); Name = name; }
public switch_map(GamePlayer Player, gamemain Main) { player = Player; main = Main; liste_map = new Texture2D[5, 5]; liste_map[1, 2] = ressource.map_1; liste_map[2, 1] = ressource.map_2; liste_map[2, 2] = ressource.map_0; x = 2; y = 2; active_map = liste_map[2, 2]; }
//main public GameOverScreen(Game game, gamemain main, SpriteBatch spritebatch, SpriteFont spritefont, Texture2D image, bool language) : base(game, spritebatch) { XmlReader reader; reader = XmlReader.Create("Francais.xml"); if (!language) { reader = XmlReader.Create("English.xml"); } string op1 = "", op2 = "", op3 = ""; while (reader.Read()) while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.Name == "recommencer") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op1 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "retour") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op2 = reader.Value.ToString(); } reader.Read(); } if (reader.Name == "fin") { while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.NodeType == XmlNodeType.Text) op3 = reader.Value.ToString(); } reader.Read(); } } string[] menuItems = { op1, op2, op3 }; this.image = image; menugenerale = new menugenerale(game, spriteBatch, spritefont, menuItems); compenents.Add(menugenerale); rec = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height); }
public mini_map(GamePlayer player, gamemain main) { Player = player; Main = main; Postion_red_dot.X = (Player.Position.X / 5) + Main.Fenetre.Width - 200; Postion_red_dot.Y = (Player.Position.Y / 5) + Main.Fenetre.Height - 100; fenetre = new Rectangle(Main.Fenetre.Width - 200 + 10, Main.Fenetre.Height - 100 + 10 , Main.Fenetre.Width / 5, Main.Fenetre.Height / 5); }
public override void action(gamemain main) { switch (this._Name) { case "VIE": main.player.pv_player += 25; break; case "MANA": if (main.player.mana_player < 100) main.player.mana_player += 25; break; } base.action(main); }
public GamePlayer(int taille_image_x, int taille_image_y, int nb_frameLine, int nb__framecolumn, int frame_start, int animation_speed, Vector2 position, int pv, Texture2D image, gamemain main) : base(taille_image_x, taille_image_y, nb_frameLine, nb__framecolumn, frame_start, animation_speed, position, image, main) { this.main = main; spriteFont = ressource.ecriture; position_pv.X = 300; position_pv.Y = 0; this.Direction = Direction.None; Endurance = 100; Mana = 100; Pv = 100; timer_endurance = 0; sort_selec = 1; active_sort = new sort(ressource.boule_de_feu, this); click_down = false; }
public HUD(GamePlayer Player, gamemain main) { localPlayer = Player; Main = main; //dessine les rectangle barre_vie = new Rectangle(100, 0, localPlayer.pv_player, 20); barre_endurance = new Rectangle(300, 0, localPlayer.end_player, 20); barre_mana = new Rectangle(500, 0, localPlayer.mana_player, 20); barre_experience = new Rectangle((2 * Main.Fenetre.Width / 6) - 26, Main.Fenetre.Height - 87, localPlayer.XP, 10); //dessine les truc qui entour les rectangles barre_v = new Rectangle(0, Main.Fenetre.Height - 94, 142, 34); barre_e = new Rectangle(0, Main.Fenetre.Height - 62, 142, 34); barre_m = new Rectangle(0, Main.Fenetre.Height - 30, 142, 34); barre_xp = new Rectangle((2 * Main.Fenetre.Width / 6) - 30, Main.Fenetre.Height - 80 , (Main.Fenetre.Width / 5) + 150, 10); //dessine une mini map mini_map = new mini_map(localPlayer, main); }
public GamePlayer(int taille_image_x, int taille_image_y, int nb_frameLine, int nb__framecolumn, int frame_start, int animation_speed, int speed, Vector2 position, Texture2D image, gamemain main, textbox text, bool language) : base(taille_image_x, taille_image_y, nb_frameLine, nb__framecolumn, frame_start, animation_speed, speed, position, image) { equipement = new item[4]; dash = false; invulnerable = false; precInvulnarable = false; timer_invulnarable = 600; timer_inv2 = 10; timer_dash = 2; langue = language; CanMove = 0; this.main = main; this.text = text; spriteFont = ressource.ecriture; position_pv.X = 300; position_pv.Y = 0; this.Direction = Direction.None; attaque = 10; defense = 10; magie = 10; Endurance = 100; Mana = 100; Pv = 100; timer_endurance = 0; sort_selec = 1; obj_selec = 1; active_sort = new sort(ressource.boule_de_feu, this); click_down = false; levelup = false; nb_amelioration = 0; inventaire = new item[5, 5]; nb_objet = new int[25]; HitBox = new Rectangle((int)position.X, (int)position.Y, 32, 32); in_action = false; text.Is_shown = false; speed_max = Speed; }
public Donjon ReceiveDungeon(gamemain main) { Thread.Sleep(500); MemoryStream m = new MemoryStream(); Donjon sol = new Donjon(); Sentstream = client.GetStream(); BinaryReader t; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { t = new BinaryReader(Sentstream); if (t.ReadInt32() == 1) { Map transit = new Map(); transit.Coffres = /*(Templar.Coffre[,])*/Serialiseur.Deserialize(Sentstream) as Templar.Coffre[,]; transit.colision = (int[,])Serialiseur.Deserialize(Sentstream); transit.mob = (Vector2[,])Serialiseur.Deserialize(Sentstream); int caca = t.ReadInt32(); for (int k = 0; k < caca; k++) { int a = t.ReadInt32(); Vector2 re = (Vector2)Serialiseur.Deserialize(Sentstream); transit.monstre.Add(new NPC(32, 48, 4, 3, a, 15, 2, re, ressource.mob, main.player, transit)); } transit.objet = (Vector2[,])Serialiseur.Deserialize(Sentstream); transit.tiles = (Vector2[,])Serialiseur.Deserialize(Sentstream); transit.Tilelist = (Tile[,])Serialiseur.Deserialize(Sentstream); sol.Map[i, j] = transit; } else sol.Map[i, j] = null; } } sol.map = (Vector2)Serialiseur.Deserialize(client.GetStream()); sol.position_J = (Vector2)Serialiseur.Deserialize(client.GetStream()); return sol; }
public virtual void action(gamemain main) { }
protected override void Update(GameTime gameTime) { /* timer_musique++; while (MediaPlayer.Volume != 10) if (timer_musique == 30) { MediaPlayer.Volume++; timer_musique = 0; } */ keyboard = Keyboard.GetState(); # region gameover if (activeScreen == gameover) { if (checkKey(Keys.Enter)) { if (gameover.SelectedIndex == 0) { } if (gameover.SelectedIndex == 1) { ressource.selection.Play(); activeScreen.hide(); activeScreen = menu; activeScreen.Show(); } if (gameover.SelectedIndex == 2) { ressource.selection.Play(); this.Exit(); } } } #endregion #region screen_menu_principal if (activeScreen == menu) { if (checkKey(Keys.Enter)) { if (menu.SelectedIndex == 0) { ressource.selection.Play(); activeScreen.hide(); activeScreen = menudujeu; activeScreen.Show(); } else if (menu.SelectedIndex == 1) { } else if (menu.SelectedIndex == 2) { ressource.selection.Play(); activeScreen.hide(); activeScreen = edm; activeScreen.Show(); } else if (menu.SelectedIndex == 3) { ressource.selection.Play(); activeScreen.hide(); activeScreen = option; activeScreen.Show(); } else if (menu.SelectedIndex == 4) { ressource.selection.Play(); this.Exit(); } } } #endregion #region menu_1_Joueur else if (activeScreen == menudujeu) { if (checkKey(Keys.Enter)) { if (menudujeu.SelectedIndex == 0) { main = new gamemain(this, spriteBatch, activeScreen); Components.Add(main); main.hide(); ressource.selection.Play(); activeScreen.hide(); activeScreen = main; activeScreen.Show(); } else if (menudujeu.SelectedIndex == 1) { ressource.selection.Play(); activeScreen.hide(); activeScreen = main; activeScreen.Show(); } else if (menudujeu.SelectedIndex == 2) { ressource.selection.Play(); activeScreen.hide(); activeScreen = menu; activeScreen.Show(); } } } #endregion #region screen_action else if (activeScreen == main) { if (checkKey(Keys.Escape)) { activeScreen.hide(); activeScreen = pause; activeScreen.Show(); } } #endregion #region screen_pause else if (activeScreen == pause) { if (checkKey(Keys.Enter)) { if (pause.SelectedIndex == 0) { } else if (pause.SelectedIndex == 1) { } else if (pause.SelectedIndex == 2) { } else if (pause.SelectedIndex == 3) { ressource.selection.Play(); activeScreen.hide(); activeScreen = menu; activeScreen.Show(); } } if (checkKey(Keys.Escape)) { activeScreen.hide(); activeScreen = main; activeScreen.Show(); } } #endregion #region screen_option else if (activeScreen == option) { if (keyboard.IsKeyUp(Keys.H)) click_down = false; if (keyboard.IsKeyUp(Keys.J)) click_down = false; if (keyboard.IsKeyDown(Keys.K)) { SoundEffect.MasterVolume += 0.1f; } if (keyboard.IsKeyDown(Keys.L)) { SoundEffect.MasterVolume -= 0.1f; } if (keyboard.IsKeyDown(Keys.H) && click_down == false) { click_down = true; MediaPlayer.Volume += 0.1f; } if (keyboard.IsKeyDown(Keys.J) && click_down == false) { MediaPlayer.Volume -= 0.1f; click_down = true; } if (checkKey(Keys.Enter)) { if (option.SelectedIndex == 0) { ressource.selection.Play(); if (ecran == false) { graphics.ToggleFullScreen(); graphics.PreferredBackBufferHeight = 1920; graphics.PreferredBackBufferWidth = 1080; ecran = true; } } if (option.SelectedIndex == 1) { ressource.selection.Play(); if (ecran == true) { graphics.ToggleFullScreen(); graphics.PreferredBackBufferHeight = 1920; graphics.PreferredBackBufferWidth = 1080; ecran = false; } } if (option.SelectedIndex == 2) { ressource.selection.Play(); MediaPlayer.IsMuted = false; SoundEffect.MasterVolume = 0.5f; } if (option.SelectedIndex == 3) { ressource.selection.Play(); MediaPlayer.IsMuted = true; SoundEffect.MasterVolume = 0; } if (option.SelectedIndex == 4) { ressource.selection.Play(); activeScreen.hide(); activeScreen = menu; activeScreen.Show(); } } } #endregion #region screen_EDM if (activeScreen == edm) { if (checkKey(Keys.Escape)) { activeScreen.hide(); activeScreen = pause; activeScreen.Show(); } } #endregion base.Update(gameTime); oldKeyboard = keyboard; }
public void load_mob(string path, gamemain main) { int j = 0; StreamReader sr = new StreamReader(path); string ligne; while ((ligne = sr.ReadLine()) != null) { for (int i = 0; i < tiles.GetLength(0); i++) { if (ligne[i] != cursor.vec_to_id(new Vector2(15, 15))) { switch ((int)cursor.id_to_vec(ligne[i]).X) { case 0: monstre.Add(new NPC(32, 48, 4, 3, 1, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 1: monstre.Add(new NPC(32, 48, 4, 3, 4, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 2: monstre.Add(new NPC(32, 48, 4, 3, 7, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 3: monstre.Add(new NPC(32, 48, 4, 3, 10, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 5: monstre.Add(new NPC(32, 48, 4, 3, 16, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 6: monstre.Add(new NPC(32, 48, 4, 3, 19, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 7: monstre.Add(new NPC(32, 48, 4, 3, 22, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 8: monstre.Add(new NPC(32, 48, 4, 3, 25, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 9: monstre.Add(new NPC(32, 48, 4, 3, 28, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 10: monstre.Add(new NPC(32, 48, 4, 3, 31, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 11: monstre.Add(new NPC(32, 48, 4, 3, 34, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 12: monstre.Add(new NPC(32, 48, 4, 3, 37, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 13: monstre.Add(new NPC(32, 48, 4, 3, 40, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; case 14: monstre.Add(new NPC(32, 48, 4, 3, 43, 15, 2, new Vector2(i * 32, j * 32), ressource.mob, main.player, this)); break; } } } j += 1; } sr.Close(); }
protected override void Update(GameTime gameTime) { keyboard = Keyboard.GetState(); mouse = Mouse.GetState(); Data.Update(); # region gameover if (activeScreen == gameover) { if (checkKey(Keys.Enter)) { if (gameover.SelectedIndex == 0) { main = new gamemain(this, spriteBatch, activeScreen, new Donjon(@"Donjons\" + creation.donjon, false), false, "", creation.donjon, language); Components.Add(main); main.hide(); ressource.selection.Play(); activeScreen.hide(); activeScreen = main; activeScreen.Show(); } if (gameover.SelectedIndex == 1) { ressource.selection.Play(); activeScreen.hide(); activeScreen = menu; activeScreen.Show(); if (main.Is_Server) main.Serveur.StopConnexion(); if (main.Is_Client) main.Client.StopConnexion(); } if (gameover.SelectedIndex == 2) { ressource.selection.Play(); if (main.Is_Server) main.Serveur.StopConnexion(); if (main.Is_Client) main.Client.StopConnexion(); this.Exit(); } } } #endregion #region menu_deuxJ if (activeScreen == menudeux) { if (Data.keyboardState.IsKeyDown(Keys.Escape)) { activeScreen.hide(); activeScreen = menu; activeScreen.Show(); } if (Data.keyboardState.IsKeyDown(Keys.Enter)) { /* main = new gamemain(this, spriteBatch, activeScreen, new Donjon(@"Donjons\" + creation.donjon, false), true, box.Saisie, creation.donjon, language); main.IP = menudeux.box.Saisie; main.Is_Client = menudeux.selec; main.Is_Server = !menudeux.selec;*/ Is_server = !menudeux.selec; Is_Client = menudeux.selec; if (Is_server) { ressource.selection.Play(); activeScreen.hide(); activeScreen = creation; activeScreen.Show(); } if (Is_Client) { client = new Client(box.Saisie); main = new gamemain(this, spriteBatch, activeScreen, null, true, box.Saisie, creation.donjon,language); Donjon donj = client.ReceiveDungeon(main); main.map = new switch_map(main.player, donj, donj.name); main.map.x = (int)donj.map.X; main.map.y = (int)donj.map.Y; main.Is_Client = true; main.Is_Server = false; main.Client = client; main.lZombie(); //main.AddLocalplayer(); main.AddHUD(); main.AddP2(); Components.Add(main); main.hide(); ressource.selection.Play(); activeScreen.hide(); activeScreen = main; activeScreen.Show(); } /* main.StartReseauConnexion(); Components.Add(main); main.hide(); ressource.selection.Play(); activeScreen.hide(); activeScreen = main; activeScreen.Show();*/ } } #endregion #region screen_menu_principal if (activeScreen == menu) { if (checkKey(Keys.Enter)) { if (menu.SelectedIndex == 0) { ressource.selection.Play(); menudujeu = new menudujeu(this, spriteBatch, Content.Load<SpriteFont>("spriteFont"), ressource.th, language); Components.Add(menudujeu); activeScreen.hide(); activeScreen = menudujeu; activeScreen.Show(); } else if (menu.SelectedIndex == 1) { ressource.selection.Play(); menudeux = new menudeux(this, spriteBatch, ref box); Components.Add(menudeux); creation.hide(); activeScreen.hide(); activeScreen = menudeux; activeScreen.Show(); } else if (menu.SelectedIndex == 2) { ressource.selection.Play(); edm = new EDM(this, spriteBatch, language); Components.Add(edm); activeScreen.hide(); activeScreen = edm; activeScreen.Show(); } else if (menu.SelectedIndex == 3) { ressource.selection.Play(); activeScreen.hide(); activeScreen = Option; activeScreen.Show(); } else if (menu.SelectedIndex == 4) { ressource.selection.Play(); this.Exit(); } } } #endregion #region creation else if (activeScreen == creation) { if (creation.change == true) { if (Is_server) { main = new gamemain(this, spriteBatch, activeScreen, new Donjon(@"Donjons\" + @creation.donjon, false), false, "", creation.donjon,language); main.Is_Server = true; main.Is_Client = false; main.StartReseauConnexion(); main.Serveur.SendDungeon(main.donj); Components.Add(main); main.hide(); creation.change = false; ressource.selection.Play(); activeScreen.hide(); activeScreen = main; activeScreen.Show(); } else { main = new gamemain(this, spriteBatch, activeScreen, new Donjon(@"Donjons\" + @creation.donjon, false), false, "", creation.donjon, language); Components.Add(main); main.hide(); creation.change = false; ressource.selection.Play(); activeScreen.hide(); activeScreen = main; activeScreen.Show(); } } } #endregion #region menu_1_Joueur else if (activeScreen == menudujeu) { if (checkKey(Keys.Enter)) { if (menudujeu.SelectedIndex == 0) { ressource.selection.Play(); creation = new creat_perso(this, spriteBatch, ressource.pixel,language); Components.Add(creation); activeScreen.hide(); activeScreen = creation; activeScreen.Show(); } else if (menudujeu.SelectedIndex == 1) { ressource.selection.Play(); activeScreen.hide(); activeScreen = main; activeScreen.Show(); } else if (menudujeu.SelectedIndex == 2) { ressource.selection.Play(); activeScreen.hide(); activeScreen = menu; activeScreen.Show(); } } } #endregion else if (activeScreen == victoire) { if(checkKey(Keys.Escape)) { activeScreen.hide(); activeScreen = menu; activeScreen.Show(); } } #region screen_action else if (activeScreen == main) { if (main.victoire == true) { victoire = new victory(this, spriteBatch); Components.Add(victoire); activeScreen.hide(); activeScreen = victoire; activeScreen.Show(); } if (main.player.pv_player <= 0) { gameover = new GameOverScreen(this, main, spriteBatch, ressource.ecriture, ressource.gameover, language); Components.Add(gameover); activeScreen.hide(); activeScreen = gameover; activeScreen.Show(); } if (checkKey(Keys.Escape)) { pause = new menudepause(this, spriteBatch, ressource.ecriture, ressource.pixel, language); Components.Add(pause); activeScreen.hide(); activeScreen = pause; activeScreen.Show(); } } #endregion #region inventaire else if (activeScreen == inventaire) { if (checkKey(Keys.Escape)) { activeScreen.hide(); activeScreen = main; activeScreen.Show(); } } #endregion #region screen_pause else if (activeScreen == pause) { if (checkKey(Keys.Enter)) { if (pause.SelectedIndex == 0) { activeScreen.hide(); inventaire = new Inventaire(this, spriteBatch, main, language); Components.Add(inventaire); activeScreen = inventaire; activeScreen.Show(); } else if (pause.SelectedIndex == 1) { activeScreen.hide(); carac = new Caracteristique(this, spriteBatch, main.player, language); Components.Add(carac); activeScreen = carac; activeScreen.Show(); } else if (pause.SelectedIndex == 2) { save = new Sauvegarde(main.map, main.player); save.Save(); activeScreen.hide(); activeScreen = main; activeScreen.Show(); } else if (pause.SelectedIndex == 3) { load = new Chargement(main.player, main.map, main.player, main); load.load_game(); activeScreen.hide(); activeScreen = main; activeScreen.Show(); } else if (pause.SelectedIndex == 4) { ressource.selection.Play(); if (main.Is_Server) main.Serveur.StopConnexion(); if (main.Is_Client) main.Client.StopConnexion(); activeScreen.hide(); activeScreen = menu; activeScreen.Show(); } } if (checkKey(Keys.Escape)) { activeScreen.hide(); activeScreen = main; activeScreen.Show(); } } #endregion #region screen_option else if (activeScreen == Option) { if (keyboard.IsKeyUp(Keys.H) && keyboard.IsKeyUp(Keys.J) && keyboard.IsKeyUp(Keys.K) && keyboard.IsKeyUp(Keys.L)) click_down = false; if (keyboard.IsKeyDown(Keys.L) && SoundEffect.MasterVolume < 0.99f && click_down == false) SoundEffect.MasterVolume += 0.01f; if (keyboard.IsKeyDown(Keys.K) && SoundEffect.MasterVolume > 0.01f && click_down == false) SoundEffect.MasterVolume -= 0.01f; if (keyboard.IsKeyDown(Keys.J) && MediaPlayer.Volume < 0.99f && click_down == false) MediaPlayer.Volume += 0.01f; if (keyboard.IsKeyDown(Keys.H) && MediaPlayer.Volume > 0.01f && click_down == false) MediaPlayer.Volume -= 0.01f; if (checkKey(Keys.Enter)) { if (Option.SelectedIndex == 0) { ressource.selection.Play(); if (ecran == false) { graphics.ToggleFullScreen(); ecran = true; } } if (Option.SelectedIndex == 1) { ressource.selection.Play(); if (ecran == true) { graphics.ToggleFullScreen(); ecran = false; } } if (Option.SelectedIndex == 2) { ressource.selection.Play(); MediaPlayer.IsMuted = false; SoundEffect.MasterVolume = 0.5f; } if (Option.SelectedIndex == 3) { ressource.selection.Play(); MediaPlayer.IsMuted = true; SoundEffect.MasterVolume = 0; } if (Option.SelectedIndex == 4) { ressource.selection.Play(); language = !language; Option = new option(this, spriteBatch, Content.Load<SpriteFont>("spriteFont"), ressource.option, language); Components.Add(Option); activeScreen.hide(); activeScreen = Option; activeScreen.Show(); } if (Option.SelectedIndex == 5) { ressource.selection.Play(); menu = new menu(this, spriteBatch, Content.Load<SpriteFont>("SpriteFont"), ressource.templar, language); Components.Add(menu); activeScreen.hide(); activeScreen = menu; activeScreen.Show(); } } } #endregion #region screen_EDM if (activeScreen == edm) { if (checkKey(Keys.Escape)) { activeScreen.hide(); activeScreen = menu; activeScreen.Show(); } } #endregion #region caracteristique if (activeScreen == carac) { if (checkKey(Keys.Escape)) { activeScreen.hide(); activeScreen = main; activeScreen.Show(); } } #endregion base.Update(gameTime); oldKeyboard = keyboard; oldmouse = mouse; }
public void Parser(gamemain Infos) { BinaryReader BR = new BinaryReader(Sentstream); if (Sentstream.DataAvailable) { type = BR.ReadInt32(); switch (type) { case 11: int t = BR.ReadInt32(); switch (t) { case 3: Infos.player2.direction = Direction.Up; Infos.player2.ChangeFrameline(3); break; case 1: Infos.player2.direction = Direction.Down; Infos.player2.ChangeFrameline(1); break; case 2: Infos.player2.direction = Direction.Left; Infos.player2.ChangeFrameline(2); break; case 4: Infos.player2.direction = Direction.Right; Infos.player2.ChangeFrameline(4); break; case 0: Infos.player2.direction = Direction.None; Infos.player2.ChangeFrameline(Infos.player.Frame_start); Infos.player2.timer = 0; break; } BR.ReadInt32(); break; case 1: Infos.same_map = (Infos.map.x == BR.ReadInt32() && Infos.map.y == BR.ReadInt32()); break; case 2: Infos.player2.chgt_position(BR.ReadInt32(), BR.ReadInt32()); break; case 31: Infos.List_Sort.RemoveAt(BR.ReadInt32()); BR.ReadInt32(); break; case 32: int transit = BR.ReadInt32(); Infos.player2.Sort_selec = transit; if (transit == 1) { Infos.List_Sort.Add(new sort(ressource.boule_de_feu, Infos.player2)); } else { Infos.List_Sort.Add(new sort(ressource.glace, Infos.player2)); } BR.ReadInt32(); break; case 41: Infos.List_Zombie.RemoveAt(BR.ReadInt32()); BR.ReadInt32(); break; case 42: Infos.List_Zombie.Add(new NPC(24, 32, 4, 2, 1, 15, 8, Infos.position_npc, ressource.zombie, Infos.player, Infos.map.Active_Map)); BR.ReadInt32(); BR.ReadInt32(); break; case 99: Infos.same_map = (Infos.map.x == BR.ReadInt32() && Infos.map.y == BR.ReadInt32()); break; } if (Sentstream.DataAvailable) { Parser(Infos); } } }
protected override void LoadContent() { ressource.loadcontent(Content); spriteBatch = new SpriteBatch(GraphicsDevice); gameover = new GameOverScreen(this, spriteBatch, ressource.ecriture, ressource.gameover); Components.Add(gameover); gameover.hide(); edm = new EDM(this, spriteBatch); Components.Add(edm); edm.hide(); pause = new menudepause(this, spriteBatch, ressource.ecriture, ressource.pixel); Components.Add(pause); pause.hide(); menu = new menu(this, spriteBatch, Content.Load<SpriteFont>("SpriteFont"), ressource.templar); Components.Add(menu); menu.hide(); menudujeu = new menudujeu(this, spriteBatch, Content.Load<SpriteFont>("spriteFont"), ressource.th); Components.Add(menudujeu); menudujeu.hide(); option = new option(this, spriteBatch, Content.Load<SpriteFont>("spriteFont"), ressource.option); Components.Add(option); option.hide(); main = new gamemain(this, spriteBatch, activeScreen); Components.Add(main); main.hide(); activeScreen = menu; activeScreen.Show(); MediaPlayer.Play(ressource.menu); MediaPlayer.IsRepeating = true; SoundEffect.MasterVolume = 0.5f; ecran = false; }
public override void action(gamemain main) { if (positin_tile == new Vector2(0, 0)) { utilité = op1; usable = true; } else if (positin_tile == new Vector2(1, 0)) { utilité = op2; usable = true; } else if (positin_tile == new Vector2(2, 0)) { main.player.pv_player += 10; } else if (positin_tile == new Vector2(0, 1)) { main.List_Zombie.Clear(); utilité = op8; usable = true; } else if (positin_tile == new Vector2(1, 1)) { main.List_Zombie.RemoveAt(rd.Next(main.List_Zombie.Count)); utilité = op9; usable = true; } else if (positin_tile == new Vector2(2, 1)) { utilité = op10; main.player.pv_player += 20; usable = true; } else if (positin_tile == new Vector2(0, 2)) { utilité = op15; usable = true; } else if (positin_tile == new Vector2(1, 2)) { utilité = op16; main.player.invulnerable = true; usable = true; } else if (positin_tile == new Vector2(2, 2)) { utilité = op17; main.player.pv_player += 0; usable = true; } else if (positin_tile == new Vector2(0, 3)) { utilité = op22; usable = true; } else if (positin_tile == new Vector2(1, 3)) { utilité = op23; usable = true; } else if (positin_tile == new Vector2(2, 3)) { utilité = op24; usable = true; } else if (positin_tile == new Vector2(0, 4)) { utilité = op29; usable = true; } else if (positin_tile == new Vector2(1, 4)) { utilité = op30; usable = true; } else if (positin_tile == new Vector2(2, 4)) { utilité = op31; usable = true; } else if (positin_tile == new Vector2(0, 5)) { utilité = op36; usable = true; } else if (positin_tile == new Vector2(1, 5)) { utilité = op37; usable = true; } else if (positin_tile == new Vector2(2, 5)) { utilité = op38; usable = true; } else if (positin_tile == new Vector2(0, 6)) { utilité = op43; usable = true; } else if (positin_tile == new Vector2(1, 6)) { utilité = op44; usable = true; } else if (positin_tile == new Vector2(2, 6)) { utilité = op45; usable = true; } base.action(main); }
public void update(GamePlayer player, gamemain main) { active_map = listes_map[x, y]; if (player != null) { if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 4) || active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 7)) && x - 1 >= 0 && listes_map[x - 1, y] != null) { x--; player.Position = new Vector2(25 * 32 - 64, player.Position.Y); main.List_Objet_Map.Clear(); main.List_Zombie.Clear(); main.List_Sort.Clear(); main.List_wall.Clear(); active_map = listes_map[x, y]; //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main); main.List_Zombie = active_map.monstre; } else if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 7) || active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 6)) && y - 1 >= 0 && listes_map[x, y - 1] != null) { y--; player.Position = new Vector2(player.Position.X, 18 * 32 - 64); main.List_Objet_Map.Clear(); main.List_Zombie.Clear(); main.List_Sort.Clear(); main.List_wall.Clear(); active_map = listes_map[x, y]; //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main); main.List_Zombie = active_map.monstre; } else if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(0, 5) || active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 4)) && listes_map[x + 1, y] != null) { x++; player.Position = new Vector2(0 + 32, player.Position.Y); if (main.List_Objet_Map != null && main.List_Zombie != null && main.List_Sort != null & main.List_wall != null) { main.List_Objet_Map.Clear(); main.List_Zombie.Clear(); main.List_Sort.Clear(); main.List_wall.Clear(); } active_map = listes_map[x, y]; //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main); main.List_Zombie = active_map.monstre; } else if ((active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 5) || active_map.objet[(int)player.Position.X / 32, (int)player.position_player.Y / 32] == new Vector2(1, 4)) && listes_map[x, y + 1] != null) { y++; player.Position = new Vector2(player.Position.X, 0 + 32); main.List_Objet_Map.Clear(); main.List_Zombie.Clear(); main.List_Sort.Clear(); main.List_wall.Clear(); active_map = listes_map[x, y]; //active_map.load_mob(@"Donjons\" + @Directorie + @"\Map" + active_map.Nb + @"\creature" + @".txt", main); main.List_Zombie = active_map.monstre; } } }